home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 22 / macformat_22.iso / Shareware / Programación / enteract-377 / enteract-377.sit / EnterAct Stuff / Documentation / hAWK_notes.h < prev    next >
MacBinary  |  1992-11-22  |  44.4 KB  |  [TEXT/KEEN]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: hAWK_notes.h

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sun Nov 22 02:30:58 1992, modified Sun Nov 22 02:30:58 1992, creator 'KEEN', type ASCII, 44751 bytes "hAWK_notes.h" , at 0xaf4f 408 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[KEEN]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 68 41 57 4b 5f 6e | 6f 74 65 73 2e 68 00 00 |..hAWK_n|otes.h..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4b 45 45 | 4e 01 00 00 00 00 00 00 |.TEXTKEE|N.......|
|00000050| 00 00 00 00 00 ae cf 00 | 00 01 98 a7 34 e7 b2 a7 |........|....4...|
|00000060| 34 e7 b2 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |4.......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 b8 f4 00 00 |........|........|
|00000080| 2f 2a 20 41 64 64 20 74 | 68 69 73 20 66 69 6c 65 |/* Add t|his file|
|00000090| 20 74 6f 20 61 6e 20 45 | 6e 74 65 72 41 63 74 20 | to an E|nterAct |
|000000a0| 70 72 6f 6a 65 63 74 20 | 28 61 6e 64 20 75 70 64 |project |(and upd|
|000000b0| 61 74 65 20 74 68 65 20 | 64 69 63 74 69 6f 6e 61 |ate the |dictiona|
|000000c0| 72 79 29 0d 66 6f 72 20 | 61 20 62 69 74 20 6f 66 |ry).for |a bit of|
|000000d0| 20 68 65 6c 70 20 77 69 | 74 68 20 68 41 57 4b 20 | help wi|th hAWK |
|000000e0| 70 72 6f 67 72 61 6d 6d | 69 6e 67 2e 0d 2a 2f 0d |programm|ing..*/.|
|000000f0| 2f 2a 20 54 68 69 73 20 | 68 65 6c 70 20 69 73 20 |/* This |help is |
|00000100| 67 65 6e 65 72 61 6c 2c | 20 61 6e 64 20 64 65 66 |general,| and def|
|00000110| 69 6e 65 73 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |ines the| followi|
|00000120| 6e 67 20 74 65 72 6d 73 | 3a 0d 74 65 72 6d 09 09 |ng terms|:.term..|
|00000130| 09 77 68 61 74 d5 73 20 | 69 6e 20 74 68 65 20 6e |.what.s |in the n|
|00000140| 6f 74 65 0d 2d 2d 2d 2d | 09 09 09 2d 2d 2d 2d 2d |ote.----|...-----|
|00000150| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|00000160| 76 61 72 69 61 62 6c 65 | 73 09 09 68 41 57 4b d5 |variable|s..hAWK.|
|00000170| 73 20 62 75 69 6c 74 d0 | 69 6e 20 76 61 72 69 61 |s built.|in varia|
|00000180| 62 6c 65 73 0d 61 72 72 | 61 79 09 09 09 67 65 6e |bles.arr|ay...gen|
|00000190| 65 72 61 6c 20 64 69 73 | 63 75 73 73 69 6f 6e 0d |eral dis|cussion.|
|000001a0| 69 6e 09 09 09 09 74 68 | 65 20 d2 69 6e d3 20 6f |in....th|e .in. o|
|000001b0| 70 65 72 61 74 6f 72 0d | 42 45 47 49 4e 09 09 09 |perator.|BEGIN...|
|000001c0| 61 62 6f 75 74 20 42 45 | 47 49 4e 20 62 6c 6f 63 |about BE|GIN bloc|
|000001d0| 6b 73 0d 45 4e 44 09 09 | 09 09 64 69 74 74 6f 20 |ks.END..|..ditto |
|000001e0| 45 4e 44 20 62 6c 6f 63 | 6b 73 0d 72 65 67 75 6c |END bloc|ks.regul|
|000001f0| 61 72 09 09 09 61 20 64 | 69 73 63 75 73 73 69 6f |ar...a d|iscussio|
|00000200| 6e 20 6f 66 20 72 65 67 | 75 6c 61 72 20 65 78 70 |n of reg|ular exp|
|00000210| 72 65 73 73 69 6f 6e 73 | 2c 0d 09 09 09 09 09 77 |ressions|,......w|
|00000220| 69 74 68 20 65 78 61 6d | 70 6c 65 73 0d 70 61 74 |ith exam|ples.pat|
|00000230| 74 65 72 6e 73 09 09 67 | 65 6e 65 72 61 6c 20 64 |terns..g|eneral d|
|00000240| 69 73 63 75 73 73 69 6f | 6e 0d 6f 70 65 72 61 74 |iscussio|n.operat|
|00000250| 6f 72 73 09 09 74 61 62 | 6c 65 2c 20 70 72 65 63 |ors..tab|le, prec|
|00000260| 65 64 65 6e 63 65 20 61 | 6e 64 20 64 65 66 69 6e |edence a|nd defin|
|00000270| 69 74 69 6f 6e 0d 6e 75 | 6d 65 72 69 63 20 09 09 |ition.nu|meric ..|
|00000280| 28 66 75 6e 63 74 69 6f | 6e 73 29 20 74 61 62 6c |(functio|ns) tabl|
|00000290| 65 0d 73 74 72 69 6e 67 | 20 09 09 09 28 66 75 6e |e.string| ...(fun|
|000002a0| 63 74 69 6f 6e 73 29 20 | 74 61 62 6c 65 0d 63 6f |ctions) |table.co|
|000002b0| 6e 74 72 6f 6c 09 09 09 | 66 6f 72 20 77 68 69 6c |ntrol...|for whil|
|000002c0| 65 20 64 6f 20 65 74 63 | 0d 66 75 6e 63 74 69 6f |e do etc|.functio|
|000002d0| 6e 09 09 68 6f 77 20 74 | 6f 20 64 65 66 69 6e 65 |n..how t|o define|
|000002e0| 20 6f 6e 65 2c 20 65 74 | 63 0d 70 72 69 6e 74 09 | one, et|c.print.|
|000002f0| 09 09 0d 70 72 69 6e 74 | 66 0d 72 65 64 69 72 65 |...print|f.redire|
|00000300| 63 74 09 09 72 65 64 69 | 72 65 63 74 69 6e 67 20 |ct..redi|recting |
|00000310| 69 6e 70 75 74 20 61 6e | 64 20 6f 75 74 70 75 74 |input an|d output|
|00000320| 0d 0d 54 6f 20 6c 6f 6f | 6b 20 75 70 20 6f 6e 65 |..To loo|k up one|
|00000330| 20 6f 66 20 74 68 65 20 | 61 62 6f 76 65 20 64 65 | of the |above de|
|00000340| 66 69 6e 65 64 20 74 65 | 72 6d 73 2c 20 74 79 70 |fined te|rms, typ|
|00000350| 65 20 69 74 73 20 6e 61 | 6d 65 20 28 6f 72 20 63 |e its na|me (or c|
|00000360| 6c 69 63 6b 20 61 74 20 | 74 68 65 20 65 6e 64 0d |lick at |the end.|
|00000370| 6f 66 20 74 68 65 20 6e | 61 6d 65 29 20 61 6e 64 |of the n|ame) and|
|00000380| 20 70 72 65 73 73 20 74 | 68 65 20 3c 45 6e 74 65 | press t|he <Ente|
|00000390| 72 3e 20 6b 65 79 2e 20 | 49 66 20 79 6f 75 20 68 |r> key. |If you h|
|000003a0| 61 76 65 20 74 68 65 20 | 41 75 74 6f 4c 6f 6f 6b |ave the |AutoLook|
|000003b0| 20 77 69 6e 64 6f 77 20 | 6f 70 65 6e 2c 0d 74 68 | window |open,.th|
|000003c0| 65 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 77 69 6c |e defini|tion wil|
|000003d0| 6c 20 61 70 70 65 61 72 | 20 74 68 65 72 65 20 69 |l appear| there i|
|000003e0| 66 20 79 6f 75 20 74 79 | 70 65 20 74 68 65 20 6e |f you ty|pe the n|
|000003f0| 61 6d 65 20 6f 72 20 64 | 6f 75 62 6c 65 d0 63 6c |ame or d|ouble.cl|
|00000400| 69 63 6b 0d 6f 6e 20 69 | 74 20 28 6f 72 20 63 6c |ick.on i|t (or cl|
|00000410| 69 63 6b 20 61 74 20 74 | 68 65 20 65 6e 64 20 6f |ick at t|he end o|
|00000420| 66 20 69 74 2c 20 6f 72 | 20 70 61 73 74 65 20 69 |f it, or| paste i|
|00000430| 74 2e 2e 2e 29 0d 2a 2f | 0d 73 74 72 75 63 74 20 |t...).*/|.struct |
|00000440| 76 61 72 69 61 62 6c 65 | 73 0d 09 7b 2f 2a 0d 09 |variable|s..{/*..|
|00000450| 42 75 69 6c 74 d0 69 6e | 20 76 61 72 69 61 62 6c |Built.in| variabl|
|00000460| 65 73 0d 68 41 57 4b 27 | 73 20 62 75 69 6c 74 2d |es.hAWK'|s built-|
|00000470| 69 6e 20 76 61 72 69 61 | 62 6c 65 73 20 61 72 65 |in varia|bles are|
|00000480| 3a 0d 41 52 47 43 09 09 | 09 74 68 65 20 6e 75 6d |:.ARGC..|.the num|
|00000490| 62 65 72 20 6f 66 20 69 | 6e 70 75 74 20 66 69 6c |ber of i|nput fil|
|000004a0| 65 73 20 70 6c 75 73 20 | 6f 6e 65 0d 41 52 47 56 |es plus |one.ARGV|
|000004b0| 09 09 09 61 72 72 61 79 | 20 6f 66 20 63 6f 6d 6d |...array| of comm|
|000004c0| 61 6e 64 20 6c 69 6e 65 | 20 61 72 67 75 6d 65 6e |and line| argumen|
|000004d0| 74 73 2e 20 54 68 65 20 | 61 72 72 61 79 20 69 73 |ts. The |array is|
|000004e0| 20 69 6e 64 65 78 65 64 | 20 66 72 6f 6d 0d 09 09 | indexed| from...|
|000004f0| 09 09 30 20 74 6f 20 41 | 52 47 43 20 2d 20 31 2c |..0 to A|RGC - 1,|
|00000500| 20 74 68 65 20 69 6e 70 | 75 74 20 66 69 6c 65 20 | the inp|ut file |
|00000510| 6e 61 6d 65 73 20 62 65 | 69 6e 67 20 41 52 47 56 |names be|ing ARGV|
|00000520| 5b 31 5d 20 74 68 72 6f | 75 67 68 0d 09 09 09 09 |[1] thro|ugh.....|
|00000530| 41 52 47 56 5b 41 52 47 | 43 2d 31 5d 2e 20 44 79 |ARGV[ARG|C-1]. Dy|
|00000540| 6e 61 6d 69 63 61 6c 6c | 79 20 63 68 61 6e 67 69 |namicall|y changi|
|00000550| 6e 67 20 74 68 65 20 63 | 6f 6e 74 65 6e 74 73 20 |ng the c|ontents |
|00000560| 6f 66 20 41 52 47 56 0d | 09 09 09 09 63 61 6e 20 |of ARGV.|....can |
|00000570| 63 6f 6e 74 72 6f 6c 20 | 74 68 65 20 66 69 6c 65 |control |the file|
|00000580| 73 20 75 73 65 64 20 66 | 6f 72 20 64 61 74 61 2e |s used f|or data.|
|00000590| 0d 46 49 4c 45 4e 41 4d | 45 09 09 74 68 65 20 6e |.FILENAM|E..the n|
|000005a0| 61 6d 65 20 6f 66 20 74 | 68 65 20 63 75 72 72 65 |ame of t|he curre|
|000005b0| 6e 74 20 69 6e 70 75 74 | 20 66 69 6c 65 2e 20 49 |nt input| file. I|
|000005c0| 66 20 6e 6f 20 66 69 6c | 65 73 20 61 72 65 0d 09 |f no fil|es are..|
|000005d0| 09 09 09 73 70 65 63 69 | 66 69 65 64 20 6f 6e 20 |...speci|fied on |
|000005e0| 74 68 65 20 63 6f 6d 6d | 61 6e 64 20 6c 69 6e 65 |the comm|and line|
|000005f0| 2c 20 74 68 65 20 76 61 | 6c 75 65 20 6f 66 20 46 |, the va|lue of F|
|00000600| 49 4c 45 4e 41 4d 45 20 | 69 73 0d 09 09 09 09 22 |ILENAME |is....."|
|00000610| 2d 22 2e 20 41 20 68 41 | 57 4b 20 70 72 6f 67 72 |-". A hA|WK progr|
|00000620| 61 6d 20 6d 61 79 20 64 | 6f 20 61 6c 6c 20 6f 66 |am may d|o all of|
|00000630| 20 69 74 73 20 77 6f 72 | 6b 20 69 6e 20 61 20 42 | its wor|k in a B|
|00000640| 45 47 49 4e 0d 09 09 09 | 09 62 6c 6f 63 6b 2c 20 |EGIN....|.block, |
|00000650| 77 69 74 68 20 6e 6f 20 | 6e 65 65 64 20 66 6f 72 |with no |need for|
|00000660| 20 69 6e 70 75 74 20 28 | 67 65 6e 65 72 61 74 69 | input (|generati|
|00000670| 6e 67 20 61 20 6c 69 73 | 74 20 6f 66 20 72 61 6e |ng a lis|t of ran|
|00000680| 64 6f 6d 0d 09 09 09 09 | 6e 75 6d 62 65 72 73 20 |dom.....|numbers |
|00000690| 66 6f 72 20 65 78 61 6d | 70 6c 65 29 2e 0d 46 4e |for exam|ple)..FN|
|000006a0| 52 09 09 09 09 74 68 65 | 20 69 6e 70 75 74 20 72 |R....the| input r|
|000006b0| 65 63 6f 72 64 20 6e 75 | 6d 62 65 72 20 69 6e 20 |ecord nu|mber in |
|000006c0| 74 68 65 20 63 75 72 72 | 65 6e 74 20 69 6e 70 75 |the curr|ent inpu|
|000006d0| 74 20 66 69 6c 65 2e 20 | 52 65 73 65 74 0d 09 09 |t file. |Reset...|
|000006e0| 09 09 74 6f 20 31 20 77 | 68 65 6e 20 73 74 61 72 |..to 1 w|hen star|
|000006f0| 74 69 6e 67 20 61 20 6e | 65 77 20 69 6e 70 75 74 |ting a n|ew input|
|00000700| 20 66 69 6c 65 2e 20 48 | 65 6e 63 65 20 74 68 65 | file. H|ence the|
|00000710| 20 70 61 74 74 65 72 6e | 0d 09 09 09 09 d2 46 4e | pattern|......FN|
|00000720| 52 20 3d 3d 20 31 d3 20 | 64 65 74 65 63 74 73 20 |R == 1. |detects |
|00000730| 74 68 65 20 73 74 61 72 | 74 20 6f 66 20 65 61 63 |the star|t of eac|
|00000740| 68 20 66 69 6c 65 2e 0d | 46 53 09 09 09 09 74 68 |h file..|FS....th|
|00000750| 65 20 69 6e 70 75 74 20 | 66 69 65 6c 64 20 73 65 |e input |field se|
|00000760| 70 61 72 61 74 6f 72 2c | 20 61 20 62 6c 61 6e 6b |parator,| a blank|
|00000770| 20 62 79 20 64 65 66 61 | 75 6c 74 2e 20 49 66 20 | by defa|ult. If |
|00000780| 74 68 65 0d 09 09 09 09 | 64 65 66 61 75 6c 74 20 |the.....|default |
|00000790| 46 53 20 69 73 20 75 73 | 65 64 20 74 68 65 6e 20 |FS is us|ed then |
|000007a0| 6c 65 61 64 69 6e 67 20 | 62 6c 61 6e 6b 73 20 61 |leading |blanks a|
|000007b0| 6e 64 20 74 61 62 73 20 | 61 72 65 0d 09 09 09 09 |nd tabs |are.....|
|000007c0| 74 72 69 6d 6d 65 64 20 | 66 72 6f 6d 20 24 31 2e |trimmed |from $1.|
|000007d0| 0d 49 47 4e 4f 52 45 43 | 41 53 45 09 09 63 6f 6e |.IGNOREC|ASE..con|
|000007e0| 74 72 6f 6c 73 20 74 68 | 65 20 63 61 73 65 2d 73 |trols th|e case-s|
|000007f0| 65 6e 73 69 74 69 76 69 | 74 79 20 6f 66 20 61 6c |ensitivi|ty of al|
|00000800| 6c 20 72 65 67 75 6c 61 | 72 20 65 78 70 72 65 73 |l regula|r expres|
|00000810| 73 69 6f 6e 0d 09 09 09 | 09 6f 70 65 72 61 74 69 |sion....|.operati|
|00000820| 6f 6e 73 2e 20 49 66 20 | 49 47 4e 4f 52 45 43 41 |ons. If |IGNORECA|
|00000830| 53 45 20 68 61 73 20 61 | 20 6e 6f 6e 2d 7a 65 72 |SE has a| non-zer|
|00000840| 6f 20 76 61 6c 75 65 2c | 20 74 68 65 6e 0d 09 09 |o value,| then...|
|00000850| 09 09 70 61 74 74 65 72 | 6e 20 6d 61 74 63 68 69 |..patter|n matchi|
|00000860| 6e 67 20 69 6e 20 72 75 | 6c 65 73 2c 20 66 69 65 |ng in ru|les, fie|
|00000870| 6c 64 20 73 70 6c 69 74 | 74 69 6e 67 20 77 69 74 |ld split|ting wit|
|00000880| 68 20 46 53 20 2c 0d 09 | 09 09 09 72 65 67 75 6c |h FS ,..|...regul|
|00000890| 61 72 20 65 78 70 72 65 | 73 73 69 6f 6e 20 6d 61 |ar expre|ssion ma|
|000008a0| 74 63 68 69 6e 67 20 77 | 69 74 68 20 7e 20 61 6e |tching w|ith ~ an|
|000008b0| 64 20 21 7e 20 2c 20 61 | 6e 64 20 74 68 65 20 67 |d !~ , a|nd the g|
|000008c0| 73 75 62 28 29 0d 09 09 | 09 09 2c 20 69 6e 64 65 |sub()...|.., inde|
|000008d0| 78 28 29 20 2c 20 6d 61 | 74 63 68 28 29 20 2c 20 |x() , ma|tch() , |
|000008e0| 73 70 6c 69 74 28 29 20 | 2c 20 61 6e 64 20 73 75 |split() |, and su|
|000008f0| 62 28 29 20 70 72 65 2d | 64 65 66 69 6e 65 64 0d |b() pre-|defined.|
|00000900| 09 09 09 09 66 75 6e 63 | 74 69 6f 6e 73 20 77 69 |....func|tions wi|
|00000910| 6c 6c 20 61 6c 6c 20 69 | 67 6e 6f 72 65 20 63 61 |ll all i|gnore ca|
|00000920| 73 65 20 77 68 65 6e 20 | 64 6f 69 6e 67 20 72 65 |se when |doing re|
|00000930| 67 75 6c 61 72 0d 09 09 | 09 09 65 78 70 72 65 73 |gular...|..expres|
|00000940| 73 69 6f 6e 20 6f 70 65 | 72 61 74 69 6f 6e 73 2e |sion ope|rations.|
|00000950| 20 54 68 75 73 2c 20 69 | 66 20 49 47 4e 4f 52 45 | Thus, i|f IGNORE|
|00000960| 43 41 53 45 20 69 73 20 | 6e 6f 74 20 65 71 75 61 |CASE is |not equa|
|00000970| 6c 20 74 6f 0d 09 09 09 | 09 7a 65 72 6f 2c 20 2f |l to....|.zero, /|
|00000980| 61 42 2f 20 6d 61 74 63 | 68 65 73 20 61 6c 6c 20 |aB/ matc|hes all |
|00000990| 6f 66 20 74 68 65 20 73 | 74 72 69 6e 67 73 20 22 |of the s|trings "|
|000009a0| 61 62 22 2c 20 22 61 42 | 22 2c 20 22 41 62 22 2c |ab", "aB|", "Ab",|
|000009b0| 0d 09 09 09 09 61 6e 64 | 20 22 41 42 22 2e 20 54 |.....and| "AB". T|
|000009c0| 68 65 20 69 6e 69 74 69 | 61 6c 20 76 61 6c 75 65 |he initi|al value|
|000009d0| 20 6f 66 20 49 47 4e 4f | 52 45 43 41 53 45 20 69 | of IGNO|RECASE i|
|000009e0| 73 20 7a 65 72 6f 2c 20 | 73 6f 20 61 6c 6c 0d 09 |s zero, |so all..|
|000009f0| 09 09 09 72 65 67 75 6c | 61 72 20 65 78 70 72 65 |...regul|ar expre|
|00000a00| 73 73 69 6f 6e 20 6f 70 | 65 72 61 74 69 6f 6e 73 |ssion op|erations|
|00000a10| 20 61 72 65 20 6e 6f 72 | 6d 61 6c 6c 79 20 63 61 | are nor|mally ca|
|00000a20| 73 65 2d 73 65 6e 73 69 | 74 69 76 65 2e 0d 4e 46 |se-sensi|tive..NF|
|00000a30| 09 09 09 09 74 68 65 20 | 6e 75 6d 62 65 72 20 6f |....the |number o|
|00000a40| 66 20 66 69 65 6c 64 73 | 20 69 6e 20 74 68 65 20 |f fields| in the |
|00000a50| 63 75 72 72 65 6e 74 20 | 69 6e 70 75 74 20 72 65 |current |input re|
|00000a60| 63 6f 72 64 2e 0d 4e 52 | 09 09 09 09 74 68 65 20 |cord..NR|....the |
|00000a70| 74 6f 74 61 6c 20 6e 75 | 6d 62 65 72 20 6f 66 20 |total nu|mber of |
|00000a80| 69 6e 70 75 74 20 72 65 | 63 6f 72 64 73 20 73 65 |input re|cords se|
|00000a90| 65 6e 20 73 6f 20 66 61 | 72 2e 0d 4f 46 4d 54 09 |en so fa|r..OFMT.|
|00000aa0| 09 09 74 68 65 20 6f 75 | 74 70 75 74 20 66 6f 72 |..the ou|tput for|
|00000ab0| 6d 61 74 20 66 6f 72 20 | 6e 75 6d 62 65 72 73 2c |mat for |numbers,|
|00000ac0| 20 25 2e 36 67 20 62 79 | 20 64 65 66 61 75 6c 74 | %.6g by| default|
|00000ad0| 2e 0d 4f 46 53 09 09 09 | 09 74 68 65 20 6f 75 74 |..OFS...|.the out|
|00000ae0| 70 75 74 20 66 69 65 6c | 64 20 73 65 70 61 72 61 |put fiel|d separa|
|00000af0| 74 6f 72 2c 20 61 20 62 | 6c 61 6e 6b 20 62 79 20 |tor, a b|lank by |
|00000b00| 64 65 66 61 75 6c 74 2e | 0d 4f 52 53 09 09 09 09 |default.|.ORS....|
|00000b10| 74 68 65 20 6f 75 74 70 | 75 74 20 72 65 63 6f 72 |the outp|ut recor|
|00000b20| 64 20 73 65 70 61 72 61 | 74 6f 72 2c 20 62 79 20 |d separa|tor, by |
|00000b30| 64 65 66 61 75 6c 74 20 | 61 20 6e 65 77 6c 69 6e |default |a newlin|
|00000b40| 65 2e 0d 52 53 09 09 09 | 09 74 68 65 20 69 6e 70 |e..RS...|.the inp|
|00000b50| 75 74 20 72 65 63 6f 72 | 64 20 73 65 70 61 72 61 |ut recor|d separa|
|00000b60| 74 6f 72 2c 20 62 79 20 | 64 65 66 61 75 6c 74 20 |tor, by |default |
|00000b70| 61 20 6e 65 77 6c 69 6e | 65 2e 20 52 53 20 69 73 |a newlin|e. RS is|
|00000b80| 0d 09 09 09 09 65 78 63 | 65 70 74 69 6f 6e 61 6c |.....exc|eptional|
|00000b90| 20 69 6e 20 74 68 61 74 | 20 6f 6e 6c 79 20 74 68 | in that| only th|
|00000ba0| 65 20 66 69 72 73 74 20 | 63 68 61 72 61 63 74 65 |e first |characte|
|00000bb0| 72 20 6f 66 20 69 74 73 | 20 73 74 72 69 6e 67 0d |r of its| string.|
|00000bc0| 09 09 09 09 76 61 6c 75 | 65 20 69 73 20 75 73 65 |....valu|e is use|
|00000bd0| 64 20 66 6f 72 20 73 65 | 70 61 72 61 74 69 6e 67 |d for se|parating|
|00000be0| 20 72 65 63 6f 72 64 73 | 2e 20 49 66 20 52 53 20 | records|. If RS |
|00000bf0| 69 73 20 73 65 74 20 74 | 6f 20 74 68 65 0d 09 09 |is set t|o the...|
|00000c00| 09 09 6e 75 6c 6c 20 73 | 74 72 69 6e 67 2c 20 74 |..null s|tring, t|
|00000c10| 68 65 6e 20 72 65 63 6f | 72 64 73 20 61 72 65 20 |hen reco|rds are |
|00000c20| 73 65 70 61 72 61 74 65 | 64 20 62 79 20 62 6c 61 |separate|d by bla|
|00000c30| 6e 6b 20 6c 69 6e 65 73 | 2e 0d 09 09 09 09 57 68 |nk lines|......Wh|
|00000c40| 65 6e 20 52 53 20 69 73 | 20 73 65 74 20 74 6f 20 |en RS is| set to |
|00000c50| 74 68 65 20 6e 75 6c 6c | 20 73 74 72 69 6e 67 2c |the null| string,|
|00000c60| 20 74 68 65 6e 20 74 68 | 65 20 6e 65 77 6c 69 6e | then th|e newlin|
|00000c70| 65 0d 09 09 09 09 63 68 | 61 72 61 63 74 65 72 20 |e.....ch|aracter |
|00000c80| 61 6c 77 61 79 73 20 61 | 63 74 73 20 61 73 20 61 |always a|cts as a|
|00000c90| 20 66 69 65 6c 64 20 73 | 65 70 61 72 61 74 6f 72 | field s|eparator|
|00000ca0| 2c 20 69 6e 20 61 64 64 | 69 74 69 6f 6e 20 74 6f |, in add|ition to|
|00000cb0| 0d 09 09 09 09 77 68 61 | 74 65 76 65 72 20 76 61 |.....wha|tever va|
|00000cc0| 6c 75 65 20 46 53 20 6d | 61 79 20 68 61 76 65 2e |lue FS m|ay have.|
|00000cd0| 0d 52 53 54 41 52 54 09 | 09 09 74 68 65 20 69 6e |.RSTART.|..the in|
|00000ce0| 64 65 78 20 6f 66 20 74 | 68 65 20 66 69 72 73 74 |dex of t|he first|
|00000cf0| 20 63 68 61 72 61 63 74 | 65 72 20 6d 61 74 63 68 | charact|er match|
|00000d00| 65 64 20 62 79 20 6d 61 | 74 63 68 28 29 3b 20 30 |ed by ma|tch(); 0|
|00000d10| 20 69 66 20 6e 6f 20 6d | 61 74 63 68 2e 0d 52 4c | if no m|atch..RL|
|00000d20| 45 4e 47 54 48 09 09 09 | 74 68 65 20 6c 65 6e 67 |ENGTH...|the leng|
|00000d30| 74 68 20 6f 66 20 74 68 | 65 20 73 74 72 69 6e 67 |th of th|e string|
|00000d40| 20 6d 61 74 63 68 65 64 | 20 62 79 20 6d 61 74 63 | matched| by matc|
|00000d50| 68 28 29 3b 20 2d 31 20 | 69 66 20 6e 6f 20 6d 61 |h(); -1 |if no ma|
|00000d60| 74 63 68 2e 0d 53 55 42 | 53 45 50 09 09 09 74 68 |tch..SUB|SEP...th|
|00000d70| 65 20 63 68 61 72 61 63 | 74 65 72 20 75 73 65 64 |e charac|ter used|
|00000d80| 20 74 6f 20 73 65 70 61 | 72 61 74 65 20 6d 75 6c | to sepa|rate mul|
|00000d90| 74 69 70 6c 65 20 73 75 | 62 73 63 72 69 70 74 73 |tiple su|bscripts|
|00000da0| 20 69 6e 20 61 72 72 61 | 79 0d 09 09 09 09 65 6c | in arra|y.....el|
|00000db0| 65 6d 65 6e 74 73 2c 20 | 62 79 20 64 65 66 61 75 |ements, |by defau|
|00000dc0| 6c 74 20 22 5c 30 33 34 | 22 2c 20 73 6f 6d 65 20 |lt "\034|", some |
|00000dd0| 6b 69 6e 64 61 20 75 70 | 20 61 72 72 6f 77 20 76 |kinda up| arrow v|
|00000de0| 65 72 79 20 72 61 72 65 | 20 69 6e 20 74 65 78 74 |ery rare| in text|
|00000df0| 2e 0d 28 61 6e 64 20 74 | 68 72 65 65 20 61 64 64 |..(and t|hree add|
|00000e00| 65 64 20 66 6f 72 20 74 | 68 65 20 4d 61 63 69 6e |ed for t|he Macin|
|00000e10| 74 6f 73 68 20 76 65 72 | 73 69 6f 6e 29 0d 52 55 |tosh ver|sion).RU|
|00000e20| 4e 45 52 52 09 09 09 73 | 68 6f 72 74 20 66 6f 72 |NERR...s|hort for|
|00000e30| 20 22 72 75 6e 20 65 72 | 72 6f 72 22 2c 20 61 20 | "run er|ror", a |
|00000e40| 66 69 6c 65 20 6e 61 6d | 65 20 74 68 61 74 20 79 |file nam|e that y|
|00000e50| 6f 75 20 63 61 6e 20 75 | 73 65 20 74 6f 20 70 72 |ou can u|se to pr|
|00000e60| 69 6e 74 0d 09 09 09 09 | 79 6f 75 72 20 6f 77 6e |int.....|your own|
|00000e70| 20 65 72 72 6f 72 20 6d | 65 73 73 61 67 65 73 20 | error m|essages |
|00000e80| 74 6f 2c 20 61 73 20 69 | 6e 20 0d 09 09 09 09 09 |to, as i|n ......|
|00000e90| 70 72 69 6e 74 20 22 45 | 72 72 6f 72 20 64 75 72 |print "E|rror dur|
|00000ea0| 69 6e 67 20 72 75 6e 22 | 20 3e 20 52 55 4e 45 52 |ing run"| > RUNER|
|00000eb0| 52 2e 0d 09 09 09 09 44 | 65 66 61 75 6c 74 20 6e |R......D|efault n|
|00000ec0| 61 6d 65 20 69 73 20 24 | 74 65 6d 70 52 75 6e 45 |ame is $|tempRunE|
|00000ed0| 72 72 2c 20 61 6e 64 20 | 79 6f 75 27 6c 6c 20 66 |rr, and |you'll f|
|00000ee0| 69 6e 64 20 74 68 65 20 | 66 69 6c 65 0d 09 09 09 |ind the |file....|
|00000ef0| 09 69 6e 20 74 68 65 20 | 73 61 6d 65 20 66 6f 6c |.in the |same fol|
|00000f00| 64 65 72 20 61 73 20 24 | 74 65 6d 70 53 74 64 4f |der as $|tempStdO|
|00000f10| 75 74 2e 0d 53 54 44 50 | 41 54 48 09 09 09 70 61 |ut..STDP|ATH...pa|
|00000f20| 74 68 20 6e 61 6d 65 20 | 74 68 61 74 20 63 61 6e |th name |that can|
|00000f30| 20 62 65 20 70 72 65 66 | 69 78 65 64 20 74 6f 20 | be pref|ixed to |
|00000f40| 61 6e 79 20 66 69 6c 65 | 20 6e 61 6d 65 20 79 6f |any file| name yo|
|00000f50| 75 20 77 69 73 68 20 74 | 6f 20 62 65 0d 09 09 09 |u wish t|o be....|
|00000f60| 09 77 72 69 74 74 65 6e | 20 74 6f 20 74 68 65 20 |.written| to the |
|00000f70| 73 61 6d 65 20 66 6f 6c | 64 65 72 20 61 73 20 73 |same fol|der as s|
|00000f80| 74 64 6f 75 74 20 28 24 | 74 65 6d 70 53 74 64 4f |tdout ($|tempStdO|
|00000f90| 75 74 29 2e 20 54 79 70 | 69 63 61 6c 6c 79 0d 09 |ut). Typ|ically..|
|00000fa0| 09 09 09 6c 6f 6f 6b 73 | 20 6c 69 6b 65 0d 09 09 |...looks| like...|
|00000fb0| 09 09 09 22 44 69 73 6b | 3a 66 6f 6c 64 65 72 31 |..."Disk|:folder1|
|00000fc0| 2e 2e 2e 3a 66 6f 6c 64 | 65 72 4e 3a 22 20 61 6e |...:fold|erN:" an|
|00000fd0| 64 20 74 79 70 69 63 61 | 6c 20 75 73 65 20 6c 6f |d typica|l use lo|
|00000fe0| 6f 6b 73 20 6c 69 6b 65 | 0d 09 09 09 09 09 6f 75 |oks like|......ou|
|00000ff0| 74 6e 61 6d 65 20 3d 20 | 22 4d 79 4f 75 74 46 69 |tname = |"MyOutFi|
|00001000| 6c 65 22 0d 09 09 09 09 | 09 66 75 6c 6c 4f 75 74 |le".....|.fullOut|
|00001010| 4e 61 6d 65 20 3d 20 53 | 54 44 50 41 54 48 20 6f |Name = S|TDPATH o|
|00001020| 75 74 6e 61 6d 65 3b 0d | 09 09 09 09 09 70 72 69 |utname;.|.....pri|
|00001030| 6e 74 20 22 73 6f 6d 65 | 74 68 69 6e 67 22 20 3e |nt "some|thing" >|
|00001040| 20 66 75 6c 6c 4f 75 74 | 4e 61 6d 65 3b 0d 54 49 | fullOut|Name;.TI|
|00001050| 4d 45 09 09 09 61 74 20 | 73 74 61 72 74 20 6f 66 |ME...at |start of|
|00001060| 20 72 75 6e 2c 20 65 67 | 20 22 53 75 6e 64 61 79 | run, eg| "Sunday|
|00001070| 2c 20 4f 63 74 6f 62 65 | 72 20 31 33 2c 20 31 39 |, Octobe|r 13, 19|
|00001080| 39 31 20 30 37 3a 35 38 | 20 41 4d 22 0d 09 2a 2f |91 07:58| AM"..*/|
|00001090| 7d 3b 0d 0d 73 74 72 75 | 63 74 20 61 72 72 61 79 |};..stru|ct array|
|000010a0| 0d 09 7b 2f 2a 0d 41 72 | 72 61 79 73 20 61 72 65 |..{/*.Ar|rays are|
|000010b0| 20 73 75 62 73 63 72 69 | 70 74 65 64 20 77 69 74 | subscri|pted wit|
|000010c0| 68 20 61 6e 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |h an exp|ression |
|000010d0| 62 65 74 77 65 65 6e 20 | 73 71 75 61 72 65 20 62 |between |square b|
|000010e0| 72 61 63 6b 65 74 73 2c | 0d 61 72 72 22 5b 22 65 |rackets,|.arr"["e|
|000010f0| 78 70 72 22 5d 22 2e 20 | 41 72 72 61 79 20 76 61 |xpr"]". |Array va|
|00001100| 6c 75 65 73 20 63 61 6e | 20 62 65 20 6e 75 6d 62 |lues can| be numb|
|00001110| 65 72 73 20 6f 72 20 73 | 74 72 69 6e 67 73 2c 20 |ers or s|trings, |
|00001120| 62 75 74 20 74 68 65 20 | 69 6e 64 65 78 20 69 73 |but the |index is|
|00001130| 0d 61 6c 77 61 79 73 20 | 69 6e 74 65 72 70 72 65 |.always |interpre|
|00001140| 74 65 64 20 61 73 20 61 | 20 73 74 72 69 6e 67 2e |ted as a| string.|
|00001150| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 20 77 68 | For exa|mple, wh|
|00001160| 65 6e 20 79 6f 75 20 77 | 72 69 74 65 0d 09 61 72 |en you w|rite..ar|
|00001170| 72 5b 31 5d 0d 74 68 65 | 20 31 20 69 73 20 63 6f |r[1].the| 1 is co|
|00001180| 6e 76 65 72 74 65 64 20 | 74 6f 20 74 68 65 20 73 |nverted |to the s|
|00001190| 74 72 69 6e 67 20 22 31 | 22 20 66 6f 72 20 75 73 |tring "1|" for us|
|000011a0| 65 20 61 73 20 74 68 65 | 20 61 72 72 61 79 20 69 |e as the| array i|
|000011b0| 6e 64 65 78 2c 20 73 6f | 20 61 72 72 5b 31 5d 0d |ndex, so| arr[1].|
|000011c0| 69 73 20 74 68 65 20 73 | 61 6d 65 20 61 73 20 61 |is the s|ame as a|
|000011d0| 72 72 5b 22 31 22 5d 2e | 20 54 68 69 73 20 73 6f |rr["1"].| This so|
|000011e0| 72 74 20 6f 66 20 61 72 | 72 61 79 20 69 73 20 63 |rt of ar|ray is c|
|000011f0| 61 6c 6c 65 64 20 d2 61 | 73 73 6f 63 69 61 74 69 |alled .a|ssociati|
|00001200| 76 65 d3 20 73 69 6e 63 | 65 0d 69 74 20 63 61 6e |ve. sinc|e.it can|
|00001210| 20 61 73 73 6f 63 69 61 | 74 65 20 6f 6e 65 20 73 | associa|te one s|
|00001220| 74 72 69 6e 67 20 6f 66 | 20 74 65 78 74 20 77 69 |tring of| text wi|
|00001230| 74 68 20 61 6e 79 20 6f | 74 68 65 72 2c 20 65 67 |th any o|ther, eg|
|00001240| 0d 09 09 61 72 72 5b 22 | 4a 6f 68 6e 20 48 65 6e |...arr["|John Hen|
|00001250| 72 79 22 5d 20 3d 20 22 | 77 61 73 20 61 20 6c 6f |ry"] = "|was a lo|
|00001260| 67 2d 64 72 69 76 69 6e | 20 6d 61 6e 22 0d 0d 49 |g-drivin| man"..I|
|00001270| 66 20 74 68 65 20 69 6e | 64 65 78 20 65 78 70 72 |f the in|dex expr|
|00001280| 65 73 73 69 6f 6e 20 69 | 73 20 61 6e 20 65 78 70 |ession i|s an exp|
|00001290| 72 65 73 73 69 6f 6e 20 | 6c 69 73 74 20 28 20 65 |ression |list ( e|
|000012a0| 78 70 72 31 20 22 2c 20 | 22 20 65 78 70 72 20 22 |xpr1 ", |" expr "|
|000012b0| 20 2e 2e 2e 29 22 0d 74 | 68 65 6e 20 74 68 65 20 | ...)".t|hen the |
|000012c0| 61 72 72 61 79 20 73 75 | 62 73 63 72 69 70 74 20 |array su|bscript |
|000012d0| 69 73 20 61 20 73 74 72 | 69 6e 67 20 63 6f 6e 73 |is a str|ing cons|
|000012e0| 69 73 74 69 6e 67 20 6f | 66 20 74 68 65 20 63 6f |isting o|f the co|
|000012f0| 6e 63 61 74 65 6e 61 74 | 69 6f 6e 20 6f 66 0d 74 |ncatenat|ion of.t|
|00001300| 68 65 20 28 73 74 72 69 | 6e 67 29 20 76 61 6c 75 |he (stri|ng) valu|
|00001310| 65 20 6f 66 20 65 61 63 | 68 20 65 78 70 72 65 73 |e of eac|h expres|
|00001320| 73 69 6f 6e 2c 20 73 65 | 70 61 72 61 74 65 64 20 |sion, se|parated |
|00001330| 62 79 20 74 68 65 20 76 | 61 6c 75 65 20 6f 66 20 |by the v|alue of |
|00001340| 74 68 65 0d 53 55 42 53 | 45 50 20 76 61 72 69 61 |the.SUBS|EP varia|
|00001350| 62 6c 65 2c 20 77 68 69 | 63 68 20 69 73 20 62 79 |ble, whi|ch is by|
|00001360| 20 64 65 66 61 75 6c 74 | 20 d2 5c 30 33 34 d3 20 | default| .\034. |
|00001370| 28 64 65 63 69 6d 61 6c | 20 32 38 2c 20 61 6e 20 |(decimal| 28, an |
|00001380| 75 70 20 61 72 72 6f 77 | 29 2e 0d 54 68 69 73 20 |up arrow|)..This |
|00001390| 66 61 63 69 6c 69 74 79 | 20 69 73 20 75 73 65 64 |facility| is used|
|000013a0| 20 74 6f 20 73 69 6d 75 | 6c 61 74 65 20 6d 75 6c | to simu|late mul|
|000013b0| 74 69 70 6c 79 d0 64 69 | 6d 65 6e 73 69 6f 6e 65 |tiply.di|mensione|
|000013c0| 64 20 61 72 72 61 79 73 | 2e 20 46 6f 72 0d 65 78 |d arrays|. For.ex|
|000013d0| 61 6d 70 6c 65 3a 0d 09 | 69 20 3d 20 22 41 22 20 |ample:..|i = "A" |
|000013e0| 3b 20 6a 20 3d 20 22 42 | 22 20 3b 6b 20 3d 20 22 |; j = "B|" ;k = "|
|000013f0| 43 22 0d 09 78 5b 69 2c | 20 6a 2c 20 6b 5d 20 3d |C"..x[i,| j, k] =|
|00001400| 20 22 68 65 6c 6c 6f 2c | 20 77 6f 72 6c 64 22 0d | "hello,| world".|
|00001410| 61 73 73 69 67 6e 73 20 | 74 68 65 20 73 74 72 69 |assigns |the stri|
|00001420| 6e 67 20 22 68 65 6c 6c | 6f 2c 20 77 6f 72 6c 64 |ng "hell|o, world|
|00001430| 22 20 74 6f 20 74 68 65 | 20 65 6c 65 6d 65 6e 74 |" to the| element|
|00001440| 20 6f 66 20 74 68 65 20 | 61 72 72 61 79 20 78 0d | of the |array x.|
|00001450| 77 68 69 63 68 20 69 73 | 20 69 6e 64 65 78 65 64 |which is| indexed|
|00001460| 20 62 79 20 74 68 65 20 | 73 74 72 69 6e 67 20 22 | by the |string "|
|00001470| 41 5c 30 33 34 42 5c 30 | 33 34 43 22 2e 0d 09 2a |A\034B\0|34C"...*|
|00001480| 2f 7d 3b 0d 0d 73 74 72 | 75 63 74 20 69 6e 0d 09 |/};..str|uct in..|
|00001490| 7b 2f 2a 0d 54 68 65 20 | 73 70 65 63 69 61 6c 20 |{/*.The |special |
|000014a0| 6f 70 65 72 61 74 6f 72 | 20 22 69 6e 22 20 6d 61 |operator| "in" ma|
|000014b0| 79 20 62 65 20 75 73 65 | 64 20 69 6e 20 61 6e 20 |y be use|d in an |
|000014c0| 69 66 20 73 74 61 74 65 | 6d 65 6e 74 20 74 6f 20 |if state|ment to |
|000014d0| 73 65 65 20 69 66 20 61 | 6e 0d 61 72 72 61 79 20 |see if a|n.array |
|000014e0| 68 61 73 20 61 6e 20 69 | 6e 64 65 78 20 63 6f 6e |has an i|ndex con|
|000014f0| 73 69 73 74 69 6e 67 20 | 6f 66 20 61 20 70 61 72 |sisting |of a par|
|00001500| 74 69 63 75 6c 61 72 20 | 76 61 6c 75 65 3a 0d 09 |ticular |value:..|
|00001510| 69 66 20 28 76 61 6c 20 | 69 6e 20 61 72 72 61 79 |if (val |in array|
|00001520| 29 0d 09 09 70 72 69 6e | 74 20 61 72 72 61 79 5b |)...prin|t array[|
|00001530| 76 61 6c 5d 0d 49 66 20 | 74 68 65 20 61 72 72 61 |val].If |the arra|
|00001540| 79 20 68 61 73 20 6d 75 | 6c 74 69 70 6c 65 20 73 |y has mu|ltiple s|
|00001550| 75 62 73 63 72 69 70 74 | 73 20 69 20 6a 20 6b 2c |ubscript|s i j k,|
|00001560| 20 75 73 65 0d 69 66 20 | 28 28 69 2c 20 6a 2c 6b | use.if |((i, j,k|
|00001570| 29 20 69 6e 20 61 72 72 | 61 79 29 20 69 6e 73 74 |) in arr|ay) inst|
|00001580| 65 61 64 20 2e 20 54 68 | 65 20 61 6c 74 65 72 6e |ead . Th|e altern|
|00001590| 61 74 65 0d 09 69 66 20 | 28 61 72 72 61 79 5b 76 |ate..if |(array[v|
|000015a0| 61 6c 5d 20 21 3d 20 22 | 22 29 0d 61 63 74 75 61 |al] != "|").actua|
|000015b0| 6c 6c 79 20 63 72 65 61 | 74 65 73 20 74 68 65 20 |lly crea|tes the |
|000015c0| 61 72 72 61 79 20 61 72 | 72 61 79 5b 76 61 6c 5d |array ar|ray[val]|
|000015d0| 20 65 6c 65 6d 65 6e 74 | 20 69 66 20 69 74 20 64 | element| if it d|
|000015e0| 6f 65 73 20 6e 6f 74 20 | 65 78 69 73 74 2c 20 73 |oes not |exist, s|
|000015f0| 6f 0d 75 73 69 6e 67 20 | d2 69 6e d3 20 69 73 20 |o.using |.in. is |
|00001600| 75 73 75 61 6c 6c 79 20 | 62 65 74 74 65 72 2e 0d |usually |better..|
|00001610| 0d 54 68 65 20 22 69 6e | 22 20 63 6f 6e 73 74 72 |.The "in|" constr|
|00001620| 75 63 74 20 6d 61 79 20 | 61 6c 73 6f 20 62 65 20 |uct may |also be |
|00001630| 75 73 65 64 20 69 6e 20 | 61 20 66 6f 72 20 6c 6f |used in |a for lo|
|00001640| 6f 70 20 74 6f 20 69 74 | 65 72 61 74 65 20 6f 76 |op to it|erate ov|
|00001650| 65 72 20 61 6c 6c 20 74 | 68 65 0d 65 6c 65 6d 65 |er all t|he.eleme|
|00001660| 6e 74 73 20 6f 66 20 61 | 6e 20 61 72 72 61 79 3a |nts of a|n array:|
|00001670| 0d 09 66 6f 72 20 28 69 | 20 69 6e 20 61 72 72 29 |..for (i| in arr)|
|00001680| 0d 09 09 64 65 6c 65 74 | 65 20 61 72 72 5b 69 5d |...delet|e arr[i]|
|00001690| 0d 41 6e 20 65 6c 65 6d | 65 6e 74 20 6d 61 79 20 |.An elem|ent may |
|000016a0| 62 65 20 64 65 6c 65 74 | 65 64 20 66 72 6f 6d 20 |be delet|ed from |
|000016b0| 61 6e 20 61 72 72 61 79 | 20 75 73 69 6e 67 20 74 |an array| using t|
|000016c0| 68 65 20 64 65 6c 65 74 | 65 20 73 74 61 74 65 6d |he delet|e statem|
|000016d0| 65 6e 74 2e 20 4e 65 77 | 0d 65 6c 65 6d 65 6e 74 |ent. New|.element|
|000016e0| 73 20 73 68 6f 75 6c 64 | 20 6e 6f 74 20 62 65 20 |s should| not be |
|000016f0| 61 64 64 65 64 20 74 6f | 20 61 6e 20 61 72 72 61 |added to| an arra|
|00001700| 79 20 77 68 69 6c 65 20 | 6c 6f 6f 70 69 6e 67 20 |y while |looping |
|00001710| 6f 76 65 72 20 69 74 20 | 77 69 74 68 20 74 68 65 |over it |with the|
|00001720| 0d 22 69 6e 22 20 66 6f | 72 2d 6c 6f 6f 70 2c 20 |."in" fo|r-loop, |
|00001730| 73 69 6e 63 65 20 68 41 | 57 4b 20 69 73 6e d5 74 |since hA|WK isn.t|
|00001740| 20 71 75 69 74 65 20 73 | 6d 61 72 74 20 65 6e 6f | quite s|mart eno|
|00001750| 75 67 68 20 74 6f 20 68 | 61 6e 64 6c 65 20 74 68 |ugh to h|andle th|
|00001760| 61 74 20 76 65 72 79 0d | 77 65 6c 6c 2e 0d 09 2a |at very.|well...*|
|00001770| 2f 7d 3b 0d 0d 73 74 72 | 75 63 74 20 42 45 47 49 |/};..str|uct BEGI|
|00001780| 4e 0d 09 7b 2f 2a 0d 42 | 45 47 49 4e 20 61 6e 64 |N..{/*.B|EGIN and|
|00001790| 20 45 4e 44 20 61 72 65 | 20 74 77 6f 20 73 70 65 | END are| two spe|
|000017a0| 63 69 61 6c 20 6b 69 6e | 64 73 20 6f 66 20 70 61 |cial kin|ds of pa|
|000017b0| 74 74 65 72 6e 73 20 77 | 68 69 63 68 20 61 72 65 |tterns w|hich are|
|000017c0| 20 6e 6f 74 20 74 65 73 | 74 65 64 0d 61 67 61 69 | not tes|ted.agai|
|000017d0| 6e 73 74 20 74 68 65 20 | 69 6e 70 75 74 2e 20 54 |nst the |input. T|
|000017e0| 68 65 20 61 63 74 69 6f | 6e 20 70 61 72 74 73 20 |he actio|n parts |
|000017f0| 6f 66 20 61 6c 6c 20 42 | 45 47 49 4e 20 70 61 74 |of all B|EGIN pat|
|00001800| 74 65 72 6e 73 20 61 72 | 65 20 6d 65 72 67 65 64 |terns ar|e merged|
|00001810| 20 61 73 20 69 66 0d 61 | 6c 6c 20 74 68 65 20 73 | as if.a|ll the s|
|00001820| 74 61 74 65 6d 65 6e 74 | 73 20 68 61 64 20 62 65 |tatement|s had be|
|00001830| 65 6e 20 77 72 69 74 74 | 65 6e 20 69 6e 20 61 20 |en writt|en in a |
|00001840| 73 69 6e 67 6c 65 20 42 | 45 47 49 4e 20 62 6c 6f |single B|EGIN blo|
|00001850| 63 6b 2e 20 54 68 65 79 | 20 61 72 65 0d 65 78 65 |ck. They| are.exe|
|00001860| 63 75 74 65 64 20 62 65 | 66 6f 72 65 20 61 6e 79 |cuted be|fore any|
|00001870| 20 6f 66 20 74 68 65 20 | 69 6e 70 75 74 20 69 73 | of the |input is|
|00001880| 20 72 65 61 64 2e 20 53 | 69 6d 69 6c 61 72 6c 79 | read. S|imilarly|
|00001890| 2c 20 61 6c 6c 20 74 68 | 65 20 45 4e 44 20 62 6c |, all th|e END bl|
|000018a0| 6f 63 6b 73 0d 61 72 65 | 20 6d 65 72 67 65 64 2c |ocks.are| merged,|
|000018b0| 20 61 6e 64 20 65 78 65 | 63 75 74 65 64 20 77 68 | and exe|cuted wh|
|000018c0| 65 6e 20 61 6c 6c 20 74 | 68 65 20 69 6e 70 75 74 |en all t|he input|
|000018d0| 20 69 73 20 65 78 68 61 | 75 73 74 65 64 20 28 6f | is exha|usted (o|
|000018e0| 72 20 77 68 65 6e 20 61 | 6e 20 65 78 69 74 0d 73 |r when a|n exit.s|
|000018f0| 74 61 74 65 6d 65 6e 74 | 20 69 73 20 65 78 65 63 |tatement| is exec|
|00001900| 75 74 65 64 29 2e 20 42 | 45 47 49 4e 20 61 6e 64 |uted). B|EGIN and|
|00001910| 20 45 4e 44 20 70 61 74 | 74 65 72 6e 73 20 63 61 | END pat|terns ca|
|00001920| 6e 6e 6f 74 20 62 65 20 | 63 6f 6d 62 69 6e 65 64 |nnot be |combined|
|00001930| 20 77 69 74 68 0d 6f 74 | 68 65 72 20 70 61 74 74 | with.ot|her patt|
|00001940| 65 72 6e 73 20 69 6e 20 | 70 61 74 74 65 72 6e 20 |erns in |pattern |
|00001950| 65 78 70 72 65 73 73 69 | 6f 6e 73 2e 20 42 45 47 |expressi|ons. BEG|
|00001960| 49 4e 20 61 6e 64 20 45 | 4e 44 20 70 61 74 74 65 |IN and E|ND patte|
|00001970| 72 6e 73 20 63 61 6e 6e | 6f 74 20 68 61 76 65 0d |rns cann|ot have.|
|00001980| 6d 69 73 73 69 6e 67 20 | 61 63 74 69 6f 6e 20 70 |missing |action p|
|00001990| 61 72 74 73 2e 0d 0d 09 | 42 45 47 49 4e 20 7b 46 |arts....|BEGIN {F|
|000019a0| 53 20 3d 20 22 2c 5b 20 | 5c 74 5d 2a 7c 5b 20 5c |S = ",[ |\t]*|[ \|
|000019b0| 74 5d 2b 22 7d 0d 73 65 | 74 73 20 74 68 65 20 66 |t]+"}.se|ts the f|
|000019c0| 69 65 6c 64 20 73 65 70 | 61 72 61 74 6f 72 20 74 |ield sep|arator t|
|000019d0| 6f 20 65 69 74 68 65 72 | 20 61 20 63 6f 6d 6d 61 |o either| a comma|
|000019e0| 20 66 6f 6c 6c 6f 77 65 | 64 20 62 79 20 6f 70 74 | followe|d by opt|
|000019f0| 69 6f 6e 61 6c 20 62 6c | 61 6e 6b 73 20 61 6e 64 |ional bl|anks and|
|00001a00| 0d 74 61 62 73 20 6f 72 | 20 6f 6e 65 20 6f 72 20 |.tabs or| one or |
|00001a10| 6d 6f 72 65 20 62 6c 61 | 6e 6b 73 20 61 6e 64 20 |more bla|nks and |
|00001a20| 74 61 62 73 d1 61 20 63 | 6f 6d 6d 6f 6e 20 66 69 |tabs.a c|ommon fi|
|00001a30| 65 6c 64 20 73 65 70 61 | 72 61 74 6f 72 20 69 6e |eld sepa|rator in|
|00001a40| 20 61 20 72 65 61 6c 0d | 64 61 74 61 62 61 73 65 | a real.|database|
|00001a50| 2e 0d 0d 45 4e 44 20 62 | 6c 6f 63 6b 73 20 61 72 |...END b|locks ar|
|00001a60| 65 20 6f 66 74 65 6e 20 | 75 73 65 64 20 74 6f 20 |e often |used to |
|00001a70| 66 69 6e 69 73 68 20 75 | 70 20 61 66 74 65 72 20 |finish u|p after |
|00001a80| 61 6c 6c 20 74 68 65 20 | 69 6e 70 75 74 20 68 61 |all the |input ha|
|00001a90| 73 20 62 65 65 6e 20 73 | 65 65 6e 2c 0d 61 73 20 |s been s|een,.as |
|00001aa0| 69 6e 20 74 68 69 73 20 | 6c 69 74 74 6c 65 20 70 |in this |little p|
|00001ab0| 72 6f 67 72 61 6d 3a 0d | 09 09 09 7b 6f 75 74 5b |rogram:.|...{out[|
|00001ac0| 2b 2b 6e 5d 20 3d 20 24 | 30 7d 0d 09 45 4e 44 20 |++n] = $|0}..END |
|00001ad0| 7b 66 6f 72 20 28 69 20 | 3d 20 6e 3b 20 69 20 3e |{for (i |= n; i >|
|00001ae0| 3d 20 31 3b 20 2d 2d 69 | 29 20 70 72 69 6e 74 20 |= 1; --i|) print |
|00001af0| 6f 75 74 5b 69 5d 7d 0d | 77 68 69 63 68 20 61 63 |out[i]}.|which ac|
|00001b00| 63 75 6d 75 6c 61 74 65 | 73 20 61 6c 6c 20 69 6e |cumulate|s all in|
|00001b10| 70 75 74 20 72 65 63 6f | 72 64 73 20 69 6e 20 74 |put reco|rds in t|
|00001b20| 68 65 20 61 72 72 61 79 | 20 d2 6f 75 74 d3 2c 20 |he array| .out., |
|00001b30| 61 6e 64 20 74 68 65 6e | 20 61 74 20 74 68 65 0d |and then| at the.|
|00001b40| 65 6e 64 20 70 72 69 6e | 74 73 20 6f 75 74 20 74 |end prin|ts out t|
|00001b50| 68 65 20 72 65 63 6f 72 | 64 73 20 69 6e 20 72 65 |he recor|ds in re|
|00001b60| 76 65 72 73 65 20 6f 72 | 64 65 72 2e 0d 09 2a 2f |verse or|der...*/|
|00001b70| 7d 3b 0d 0d 73 74 72 75 | 63 74 20 45 4e 44 0d 09 |};..stru|ct END..|
|00001b80| 7b 2f 2a 0d 42 45 47 49 | 4e 20 61 6e 64 20 45 4e |{/*.BEGI|N and EN|
|00001b90| 44 20 61 72 65 20 74 77 | 6f 20 73 70 65 63 69 61 |D are tw|o specia|
|00001ba0| 6c 20 6b 69 6e 64 73 20 | 6f 66 20 70 61 74 74 65 |l kinds |of patte|
|00001bb0| 72 6e 73 20 77 68 69 63 | 68 20 61 72 65 20 6e 6f |rns whic|h are no|
|00001bc0| 74 20 74 65 73 74 65 64 | 0d 61 67 61 69 6e 73 74 |t tested|.against|
|00001bd0| 20 74 68 65 20 69 6e 70 | 75 74 2e 20 54 68 65 20 | the inp|ut. The |
|00001be0| 61 63 74 69 6f 6e 20 70 | 61 72 74 73 20 6f 66 20 |action p|arts of |
|00001bf0| 61 6c 6c 20 42 45 47 49 | 4e 20 70 61 74 74 65 72 |all BEGI|N patter|
|00001c00| 6e 73 20 61 72 65 20 6d | 65 72 67 65 64 20 61 73 |ns are m|erged as|
|00001c10| 20 69 66 0d 61 6c 6c 20 | 74 68 65 20 73 74 61 74 | if.all |the stat|
|00001c20| 65 6d 65 6e 74 73 20 68 | 61 64 20 62 65 65 6e 20 |ements h|ad been |
|00001c30| 77 72 69 74 74 65 6e 20 | 69 6e 20 61 20 73 69 6e |written |in a sin|
|00001c40| 67 6c 65 20 42 45 47 49 | 4e 20 62 6c 6f 63 6b 2e |gle BEGI|N block.|
|00001c50| 20 54 68 65 79 20 61 72 | 65 0d 65 78 65 63 75 74 | They ar|e.execut|
|00001c60| 65 64 20 62 65 66 6f 72 | 65 20 61 6e 79 20 6f 66 |ed befor|e any of|
|00001c70| 20 74 68 65 20 69 6e 70 | 75 74 20 69 73 20 72 65 | the inp|ut is re|
|00001c80| 61 64 2e 20 53 69 6d 69 | 6c 61 72 6c 79 2c 20 61 |ad. Simi|larly, a|
|00001c90| 6c 6c 20 74 68 65 20 45 | 4e 44 20 62 6c 6f 63 6b |ll the E|ND block|
|00001ca0| 73 0d 61 72 65 20 6d 65 | 72 67 65 64 2c 20 61 6e |s.are me|rged, an|
|00001cb0| 64 20 65 78 65 63 75 74 | 65 64 20 77 68 65 6e 20 |d execut|ed when |
|00001cc0| 61 6c 6c 20 74 68 65 20 | 69 6e 70 75 74 20 69 73 |all the |input is|
|00001cd0| 20 65 78 68 61 75 73 74 | 65 64 20 28 6f 72 20 77 | exhaust|ed (or w|
|00001ce0| 68 65 6e 20 61 6e 20 65 | 78 69 74 0d 73 74 61 74 |hen an e|xit.stat|
|00001cf0| 65 6d 65 6e 74 20 69 73 | 20 65 78 65 63 75 74 65 |ement is| execute|
|00001d00| 64 29 2e 20 42 45 47 49 | 4e 20 61 6e 64 20 45 4e |d). BEGI|N and EN|
|00001d10| 44 20 70 61 74 74 65 72 | 6e 73 20 63 61 6e 6e 6f |D patter|ns canno|
|00001d20| 74 20 62 65 20 63 6f 6d | 62 69 6e 65 64 20 77 69 |t be com|bined wi|
|00001d30| 74 68 0d 6f 74 68 65 72 | 20 70 61 74 74 65 72 6e |th.other| pattern|
|00001d40| 73 20 69 6e 20 70 61 74 | 74 65 72 6e 20 65 78 70 |s in pat|tern exp|
|00001d50| 72 65 73 73 69 6f 6e 73 | 2e 20 42 45 47 49 4e 20 |ressions|. BEGIN |
|00001d60| 61 6e 64 20 45 4e 44 20 | 70 61 74 74 65 72 6e 73 |and END |patterns|
|00001d70| 20 63 61 6e 6e 6f 74 20 | 68 61 76 65 0d 6d 69 73 | cannot |have.mis|
|00001d80| 73 69 6e 67 20 61 63 74 | 69 6f 6e 20 70 61 72 74 |sing act|ion part|
|00001d90| 73 2e 0d 0d 09 42 45 47 | 49 4e 20 7b 46 53 20 3d |s....BEG|IN {FS =|
|00001da0| 20 22 2c 5b 20 5c 74 5d | 2a 7c 5b 20 5c 74 5d 2b | ",[ \t]|*|[ \t]+|
|00001db0| 22 7d 0d 73 65 74 73 20 | 74 68 65 20 66 69 65 6c |"}.sets |the fiel|
|00001dc0| 64 20 73 65 70 61 72 61 | 74 6f 72 20 74 6f 20 65 |d separa|tor to e|
|00001dd0| 69 74 68 65 72 20 61 20 | 63 6f 6d 6d 61 20 66 6f |ither a |comma fo|
|00001de0| 6c 6c 6f 77 65 64 20 62 | 79 20 6f 70 74 69 6f 6e |llowed b|y option|
|00001df0| 61 6c 20 62 6c 61 6e 6b | 73 20 61 6e 64 0d 74 61 |al blank|s and.ta|
|00001e00| 62 73 20 6f 72 20 6f 6e | 65 20 6f 72 20 6d 6f 72 |bs or on|e or mor|
|00001e10| 65 20 62 6c 61 6e 6b 73 | 20 61 6e 64 20 74 61 62 |e blanks| and tab|
|00001e20| 73 d1 61 20 63 6f 6d 6d | 6f 6e 20 66 69 65 6c 64 |s.a comm|on field|
|00001e30| 20 73 65 70 61 72 61 74 | 6f 72 20 69 6e 20 61 20 | separat|or in a |
|00001e40| 72 65 61 6c 0d 64 61 74 | 61 62 61 73 65 2e 0d 0d |real.dat|abase...|
|00001e50| 45 4e 44 20 62 6c 6f 63 | 6b 73 20 61 72 65 20 6f |END bloc|ks are o|
|00001e60| 66 74 65 6e 20 75 73 65 | 64 20 74 6f 20 66 69 6e |ften use|d to fin|
|00001e70| 69 73 68 20 75 70 20 61 | 66 74 65 72 20 61 6c 6c |ish up a|fter all|
|00001e80| 20 74 68 65 20 69 6e 70 | 75 74 20 68 61 73 20 62 | the inp|ut has b|
|00001e90| 65 65 6e 20 73 65 65 6e | 2c 0d 61 73 20 69 6e 20 |een seen|,.as in |
|00001ea0| 74 68 69 73 20 6c 69 74 | 74 6c 65 20 70 72 6f 67 |this lit|tle prog|
|00001eb0| 72 61 6d 3a 0d 09 09 09 | 7b 6f 75 74 5b 2b 2b 6e |ram:....|{out[++n|
|00001ec0| 5d 20 3d 20 24 30 7d 0d | 09 45 4e 44 20 7b 66 6f |] = $0}.|.END {fo|
|00001ed0| 72 20 28 69 20 3d 20 6e | 3b 20 69 20 3e 3d 20 31 |r (i = n|; i >= 1|
|00001ee0| 3b 20 2d 2d 69 29 20 70 | 72 69 6e 74 20 6f 75 74 |; --i) p|rint out|
|00001ef0| 5b 69 5d 7d 0d 77 68 69 | 63 68 20 61 63 63 75 6d |[i]}.whi|ch accum|
|00001f00| 75 6c 61 74 65 73 20 61 | 6c 6c 20 69 6e 70 75 74 |ulates a|ll input|
|00001f10| 20 72 65 63 6f 72 64 73 | 20 69 6e 20 74 68 65 20 | records| in the |
|00001f20| 61 72 72 61 79 20 d2 6f | 75 74 d3 2c 20 61 6e 64 |array .o|ut., and|
|00001f30| 20 74 68 65 6e 20 61 74 | 20 74 68 65 0d 65 6e 64 | then at| the.end|
|00001f40| 20 70 72 69 6e 74 73 20 | 6f 75 74 20 74 68 65 20 | prints |out the |
|00001f50| 72 65 63 6f 72 64 73 20 | 69 6e 20 72 65 76 65 72 |records |in rever|
|00001f60| 73 65 20 6f 72 64 65 72 | 2e 0d 09 2a 2f 7d 3b 0d |se order|...*/};.|
|00001f70| 0d 73 74 72 75 63 74 20 | 72 65 67 75 6c 61 72 20 |.struct |regular |
|00001f80| 2f 2a 65 78 70 72 65 73 | 73 69 6f 6e 20 2a 2f 0d |/*expres|sion */.|
|00001f90| 09 7b 2f 2a 0d 41 20 72 | 65 67 75 6c 61 72 20 65 |.{/*.A r|egular e|
|00001fa0| 78 70 72 65 73 73 69 6f | 6e 20 69 73 20 6e 6f 74 |xpressio|n is not|
|00001fb0| 68 69 6e 67 20 6d 6f 72 | 65 20 74 68 61 6e 20 61 |hing mor|e than a|
|00001fc0| 20 73 74 72 69 6e 67 20 | 6f 66 20 74 65 78 74 20 | string |of text |
|00001fd0| 77 69 74 68 20 6f 70 74 | 69 6f 6e 61 6c 0d 73 70 |with opt|ional.sp|
|00001fe0| 65 63 69 61 6c 20 d2 6d | 65 74 61 63 68 61 72 61 |ecial .m|etachara|
|00001ff0| 63 74 65 72 73 d3 2c 20 | 61 6e 64 20 69 6e 20 6d |cters., |and in m|
|00002000| 6f 73 74 20 63 61 73 65 | 73 20 74 68 65 20 73 74 |ost case|s the st|
|00002010| 72 69 6e 67 20 74 6f 20 | 62 65 20 75 73 65 64 20 |ring to |be used |
|00002020| 63 61 6e 0d 72 65 73 75 | 6c 74 20 66 72 6f 6d 20 |can.resu|lt from |
|00002030| 74 68 65 20 65 76 61 6c | 75 61 74 69 6f 6e 20 6f |the eval|uation o|
|00002040| 66 20 61 20 76 61 72 69 | 61 62 6c 65 2c 20 6f 72 |f a vari|able, or|
|00002050| 20 74 68 65 20 63 6f 6e | 63 61 74 65 6e 61 74 69 | the con|catenati|
|00002060| 6f 6e 20 6f 66 20 73 65 | 76 65 72 61 6c 0d 73 74 |on of se|veral.st|
|00002070| 72 69 6e 67 73 20 6f 72 | 20 76 61 72 69 61 62 6c |rings or| variabl|
|00002080| 65 73 2e 20 54 68 69 73 | 20 6d 65 61 6e 73 20 79 |es. This| means y|
|00002090| 6f 75 20 63 61 6e 20 62 | 75 69 6c 64 20 74 68 65 |ou can b|uild the|
|000020a0| 20 72 65 67 75 6c 61 72 | 20 65 78 70 72 65 73 73 | regular| express|
|000020b0| 69 6f 6e 73 20 66 6f 72 | 0d 79 6f 75 72 20 70 72 |ions for|.your pr|
|000020c0| 6f 67 72 61 6d 20 64 75 | 72 69 6e 67 20 74 68 65 |ogram du|ring the|
|000020d0| 20 65 78 65 63 75 74 69 | 6f 6e 20 6f 66 20 79 6f | executi|on of yo|
|000020e0| 75 72 20 70 72 6f 67 72 | 61 6d 2c 20 6d 6f 64 69 |ur progr|am, modi|
|000020f0| 66 79 69 6e 67 20 74 68 | 65 6d 20 6f 6e 20 74 68 |fying th|em on th|
|00002100| 65 0d 66 6c 79 20 74 6f | 20 73 75 69 74 20 63 68 |e.fly to| suit ch|
|00002110| 61 6e 67 69 6e 67 20 63 | 69 72 63 75 6d 73 74 61 |anging c|ircumsta|
|00002120| 6e 63 65 73 2e 0d 0d 50 | 61 72 74 73 20 6f 66 20 |nces...P|arts of |
|00002130| 61 20 72 65 67 75 6c 61 | 72 20 65 78 70 72 65 73 |a regula|r expres|
|00002140| 73 69 6f 6e 20 63 61 6e | 20 62 65 20 67 72 6f 75 |sion can| be grou|
|00002150| 70 65 64 20 28 77 69 74 | 68 20 6f 72 64 69 6e 61 |ped (wit|h ordina|
|00002160| 72 79 20 70 61 72 65 6e | 74 68 65 73 65 73 29 2c |ry paren|theses),|
|00002170| 0d 61 6e 64 20 6c 61 74 | 65 72 20 69 6e 20 74 68 |.and lat|er in th|
|00002180| 65 20 72 65 67 75 6c 61 | 72 20 65 78 70 72 65 73 |e regula|r expres|
|00002190| 73 69 6f 6e 20 6f 72 20 | 69 6e 20 61 20 72 65 70 |sion or |in a rep|
|000021a0| 6c 61 63 65 6d 65 6e 74 | 20 73 74 72 69 6e 67 20 |lacement| string |
|000021b0| 63 61 6e 20 62 65 0d 72 | 65 66 65 72 72 65 64 20 |can be.r|eferred |
|000021c0| 74 6f 20 62 79 20 74 68 | 65 20 67 72 6f 75 70 20 |to by th|e group |
|000021d0| d2 74 61 67 73 d3 20 5c | 31 2c 20 5c 32 2c 20 2e |.tags. \|1, \2, .|
|000021e0| 2e 2e 20 5c 39 20 77 68 | 65 72 65 20 5c 31 20 72 |.. \9 wh|ere \1 r|
|000021f0| 65 66 65 72 73 20 74 6f | 20 74 68 65 0d 67 72 6f |efers to| the.gro|
|00002200| 75 70 20 73 74 61 72 74 | 65 64 20 62 79 20 74 68 |up start|ed by th|
|00002210| 65 20 66 69 72 73 74 20 | 6c 65 66 74 20 70 61 72 |e first |left par|
|00002220| 65 6e 74 68 65 73 69 73 | 2c 20 5c 32 20 74 6f 20 |enthesis|, \2 to |
|00002230| 74 68 65 20 73 65 63 6f | 6e 64 2c 20 65 74 63 2e |the seco|nd, etc.|
|00002240| 20 54 68 65 73 65 0d 61 | 6c 6c 6f 77 20 79 6f 75 | These.a|llow you|
|00002250| 20 74 6f 20 6d 61 74 63 | 68 20 61 20 73 6d 61 6c | to matc|h a smal|
|00002260| 6c 20 70 61 74 74 65 72 | 6e 20 77 69 74 68 69 6e |l patter|n within|
|00002270| 20 74 68 65 20 63 6f 6e | 74 65 78 74 20 6f 66 20 | the con|text of |
|00002280| 61 20 6c 61 72 67 65 72 | 20 6f 6e 65 2c 0d 64 65 |a larger| one,.de|
|00002290| 74 65 63 74 20 64 75 70 | 6c 69 63 61 74 65 20 65 |tect dup|licate e|
|000022a0| 78 70 72 65 73 73 69 6f | 6e 73 2c 20 63 68 61 6e |xpressio|ns, chan|
|000022b0| 67 65 20 74 68 65 20 6f | 72 64 65 72 20 6f 66 20 |ge the o|rder of |
|000022c0| 74 68 65 20 67 72 6f 75 | 70 73 20 61 6e 64 20 73 |the grou|ps and s|
|000022d0| 6f 20 6f 6e 2e 0d 4e 6f | 74 65 20 74 68 61 74 20 |o on..No|te that |
|000022e0| 70 61 72 65 6e 74 68 65 | 73 65 73 20 68 61 76 65 |parenthe|ses have|
|000022f0| 20 74 68 65 20 68 69 67 | 68 65 73 74 20 70 72 65 | the hig|hest pre|
|00002300| 63 65 64 65 6e 63 65 20 | 6f 66 20 61 6c 6c 20 72 |cedence |of all r|
|00002310| 65 67 75 6c 61 72 0d 65 | 78 70 72 65 73 73 69 6f |egular.e|xpressio|
|00002320| 6e 20 d2 6f 70 65 72 61 | 74 6f 72 73 d3 2c 20 73 |n .opera|tors., s|
|00002330| 6f 20 74 68 65 79 20 73 | 65 72 76 65 20 74 77 6f |o they s|erve two|
|00002340| 20 70 75 72 70 6f 73 65 | 73 3b 20 63 68 61 6e 67 | purpose|s; chang|
|00002350| 69 6e 67 20 74 68 65 20 | 6f 72 64 65 72 20 69 6e |ing the |order in|
|00002360| 0d 77 68 69 63 68 20 74 | 68 65 20 6d 65 74 61 63 |.which t|he metac|
|00002370| 68 61 72 61 63 74 65 72 | 73 20 61 70 70 6c 79 2c |haracter|s apply,|
|00002380| 20 61 6e 64 20 6d 61 72 | 6b 69 6e 67 20 74 68 65 | and mar|king the|
|00002390| 20 62 6f 75 6e 64 61 72 | 69 65 73 20 6f 66 20 61 | boundar|ies of a|
|000023a0| 20 67 72 6f 75 70 2c 20 | 66 6f 72 0d 6c 61 74 65 | group, |for.late|
|000023b0| 72 20 72 65 66 65 72 65 | 6e 63 65 20 76 69 61 20 |r refere|nce via |
|000023c0| 5c 31 2e 2e 5c 39 2e 20 | 4d 6f 72 65 20 6f 6e 20 |\1..\9. |More on |
|000023d0| 74 68 69 73 20 69 6e 20 | 61 20 62 69 74 2e 0d 0d |this in |a bit...|
|000023e0| 52 65 67 75 6c 61 72 20 | 65 78 70 72 65 73 73 69 |Regular |expressi|
|000023f0| 6f 6e 73 20 61 72 65 20 | 62 75 69 6c 74 20 66 72 |ons are |built fr|
|00002400| 6f 6d 20 6f 72 64 69 6e | 61 72 79 20 63 68 61 72 |om ordin|ary char|
|00002410| 61 63 74 65 72 73 2c 20 | 74 68 65 20 65 73 63 61 |acters, |the esca|
|00002420| 70 65 0d 73 65 71 75 65 | 6e 63 65 73 0d 09 5c 74 |pe.seque|nces..\t|
|00002430| 20 20 5c 6e 20 20 5c 62 | 20 20 5c 42 20 20 5c 77 | \n \b| \B \w|
|00002440| 20 20 5c 57 20 20 5c 3c | 20 20 5c 3e 20 20 5c 31 | \W \<| \> \1|
|00002450| 20 20 5c 32 20 20 5c 33 | 20 20 5c 34 20 20 5c 35 | \2 \3| \4 \5|
|00002460| 20 20 5c 36 20 20 5c 37 | 20 20 5c 38 20 20 5c 39 | \6 \7| \8 \9|
|00002470| 0d 61 6e 64 20 66 72 6f | 6d 20 74 68 65 20 6d 65 |.and fro|m the me|
|00002480| 74 61 63 68 61 72 61 63 | 74 65 72 73 0d 09 09 09 |tacharac|ters....|
|00002490| 5c 20 5e 20 24 20 2e 20 | 5b 20 5d 20 7c 20 28 20 |\ ^ $ . |[ ] | ( |
|000024a0| 29 20 2a 20 2b 20 3f 0d | 77 68 69 63 68 20 61 72 |) * + ?.|which ar|
|000024b0| 65 20 74 68 65 20 6f 6e | 65 73 20 77 69 74 68 20 |e the on|es with |
|000024c0| 74 68 65 20 73 70 65 63 | 69 61 6c 20 70 6f 77 65 |the spec|ial powe|
|000024d0| 72 73 20 6d 65 6e 74 69 | 6f 6e 65 64 20 61 62 6f |rs menti|oned abo|
|000024e0| 76 65 2e 20 41 73 20 79 | 6f 75 20 73 61 77 20 69 |ve. As y|ou saw i|
|000024f0| 6e 0d 74 68 65 20 61 62 | 6f 76 65 20 73 65 63 74 |n.the ab|ove sect|
|00002500| 69 6f 6e 2c 20 69 66 20 | 61 20 72 65 67 75 6c 61 |ion, if |a regula|
|00002510| 72 20 65 78 70 72 65 73 | 73 69 6f 6e 20 63 6f 6e |r expres|sion con|
|00002520| 74 61 69 6e 73 20 6e 6f | 20 6d 65 74 61 63 68 61 |tains no| metacha|
|00002530| 72 61 63 74 65 72 73 20 | 74 68 65 6e 0d 69 74 20 |racters |then.it |
|00002540| 62 65 68 61 76 65 73 20 | 6c 69 6b 65 20 61 6e 20 |behaves |like an |
|00002550| 6f 72 64 69 6e 61 72 79 | 20 d2 66 69 6e 64 d3 20 |ordinary| .find. |
|00002560| 73 74 72 69 6e 67 20 69 | 6e 20 74 68 61 74 20 65 |string i|n that e|
|00002570| 61 63 68 20 63 68 61 72 | 61 63 74 65 72 20 69 6e |ach char|acter in|
|00002580| 20 74 68 65 0d 72 65 67 | 75 6c 61 72 20 65 78 70 | the.reg|ular exp|
|00002590| 72 65 73 73 69 6f 6e 20 | 6d 75 73 74 20 6d 61 74 |ression |must mat|
|000025a0| 63 68 20 61 20 63 68 61 | 72 61 63 74 65 72 20 69 |ch a cha|racter i|
|000025b0| 6e 20 74 68 65 20 73 74 | 72 69 6e 67 20 62 65 69 |n the st|ring bei|
|000025c0| 6e 67 20 73 65 61 72 63 | 68 65 64 2e 0d 54 68 65 |ng searc|hed..The|
|000025d0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 74 61 62 6c 65 | followi|ng table|
|000025e0| 20 73 75 6d 6d 61 72 69 | 7a 65 73 20 61 6c 6c 20 | summari|zes all |
|000025f0| 63 68 61 72 61 63 74 65 | 72 20 75 73 61 67 65 20 |characte|r usage |
|00002600| 69 6e 20 61 20 72 65 67 | 75 6c 61 72 20 65 78 70 |in a reg|ular exp|
|00002610| 72 65 73 73 69 6f 6e 0d | 28 77 68 65 72 65 20 61 |ression.|(where a|
|00002620| 20 62 20 63 20 61 72 65 | 20 6f 72 64 69 6e 61 72 | b c are| ordinar|
|00002630| 79 20 63 68 61 72 61 63 | 74 65 72 73 2c 20 6d 20 |y charac|ters, m |
|00002640| 69 73 20 61 20 6d 65 74 | 61 63 68 61 72 61 63 74 |is a met|acharact|
|00002650| 65 72 2c 20 72 20 69 73 | 20 61 20 72 65 67 75 6c |er, r is| a regul|
|00002660| 61 72 0d 65 78 70 72 65 | 73 73 69 6f 6e 2c 20 61 |ar.expre|ssion, a|
|00002670| 6e 64 20 64 20 69 73 20 | 61 20 64 69 67 69 74 29 |nd d is |a digit)|
|00002680| 3a 0d 0d 63 09 09 09 6d | 61 74 63 68 65 73 20 74 |:..c...m|atches t|
|00002690| 68 65 20 6e 6f 6e 2d 6d | 65 74 61 63 68 61 72 61 |he non-m|etachara|
|000026a0| 63 74 65 72 20 63 20 69 | 74 73 65 6c 66 0d 5c 6d |cter c i|tself.\m|
|000026b0| 09 09 09 6d 61 74 63 68 | 65 73 20 74 68 65 20 6c |...match|es the l|
|000026c0| 69 74 65 72 61 6c 20 63 | 68 61 72 61 63 74 65 72 |iteral c|haracter|
|000026d0| 20 6d 2c 20 65 67 20 5c | 24 20 6d 61 74 63 68 65 | m, eg \|$ matche|
|000026e0| 73 20 74 68 65 20 64 6f | 6c 6c 61 72 20 73 69 67 |s the do|llar sig|
|000026f0| 6e 2e 0d 2e 09 09 09 6d | 61 74 63 68 65 73 20 61 |n......m|atches a|
|00002700| 6e 79 20 73 69 6e 67 6c | 65 20 63 68 61 72 61 63 |ny singl|e charac|
|00002710| 74 65 72 20 65 78 63 65 | 70 74 20 6e 65 77 6c 69 |ter exce|pt newli|
|00002720| 6e 65 2e 0d 5e 09 09 09 | 6d 61 74 63 68 65 73 20 |ne..^...|matches |
|00002730| 74 68 65 20 62 65 67 69 | 6e 6e 69 6e 67 20 6f 66 |the begi|nning of|
|00002740| 20 61 20 6c 69 6e 65 20 | 6f 72 20 61 20 73 74 72 | a line |or a str|
|00002750| 69 6e 67 2e 0d 24 09 09 | 09 6d 61 74 63 68 65 73 |ing..$..|.matches|
|00002760| 20 74 68 65 20 65 6e 64 | 20 6f 66 20 61 20 6c 69 | the end| of a li|
|00002770| 6e 65 20 6f 72 20 61 20 | 73 74 72 69 6e 67 2e 0d |ne or a |string..|
|00002780| 5b 20 61 62 63 2e 2e 2e | 20 5d 09 63 68 61 72 61 |[ abc...| ].chara|
|00002790| 63 74 65 72 20 63 6c 61 | 73 73 2c 20 6d 61 74 63 |cter cla|ss, matc|
|000027a0| 68 65 73 20 61 6e 79 20 | 6f 6e 65 20 6f 66 20 74 |hes any |one of t|
|000027b0| 68 65 20 63 68 61 72 61 | 63 74 65 72 73 09 61 20 |he chara|cters.a |
|000027c0| 6f 72 20 62 20 6f 72 20 | 63 20 65 74 63 2e 2e 2e |or b or |c etc...|
|000027d0| 20 2e 0d 5b 5e 20 61 62 | 63 2e 2e 2e 20 5d 09 6e | ..[^ ab|c... ].n|
|000027e0| 65 67 61 74 65 64 20 63 | 68 61 72 61 63 74 65 72 |egated c|haracter|
|000027f0| 20 63 6c 61 73 73 2c 20 | 6d 61 74 63 68 65 73 20 | class, |matches |
|00002800| 61 6e 79 20 63 68 61 72 | 61 63 74 65 72 20 65 78 |any char|acter ex|
|00002810| 63 65 70 74 20 61 62 63 | 2e 2e 2e 0d 09 09 09 61 |cept abc|.......a|
|00002820| 6e 64 20 6e 65 77 6c 69 | 6e 65 2e 20 28 52 61 6e |nd newli|ne. (Ran|
|00002830| 67 65 73 20 6f 66 20 63 | 68 61 72 61 63 74 65 72 |ges of c|haracter|
|00002840| 73 20 6d 61 79 20 62 65 | 20 61 62 62 72 65 76 69 |s may be| abbrevi|
|00002850| 61 74 65 64 20 69 6e 0d | 09 09 09 63 68 61 72 61 |ated in.|...chara|
|00002860| 63 74 65 72 20 63 6c 61 | 73 73 65 73 2c 20 61 73 |cter cla|sses, as|
|00002870| 20 69 6e 20 5b 30 2d 39 | 5d 20 77 68 69 63 68 20 | in [0-9|] which |
|00002880| 6d 61 74 63 68 65 73 20 | 61 6e 79 20 64 69 67 69 |matches |any digi|
|00002890| 74 2c 0d 09 09 09 5b 41 | 2d 5a 61 2d 7a 5d 20 77 |t,....[A|-Za-z] w|
|000028a0| 68 69 63 68 20 6d 61 74 | 63 68 65 73 20 61 6e 79 |hich mat|ches any|
|000028b0| 20 6c 65 74 74 65 72 2c | 20 5b 5e 30 2d 39 5d 20 | letter,| [^0-9] |
|000028c0| 77 68 69 63 68 20 6d 61 | 74 63 68 65 73 0d 09 09 |which ma|tches...|
|000028d0| 09 61 6e 79 74 68 69 6e | 67 20 62 75 74 20 61 20 |.anythin|g but a |
|000028e0| 64 69 67 69 74 29 0d 5c | 77 09 09 09 6d 61 74 63 |digit).\|w...matc|
|000028f0| 68 65 73 20 61 20 d2 77 | 6f 72 64 d3 20 63 68 61 |hes a .w|ord. cha|
|00002900| 72 61 63 74 65 72 2c 20 | 65 78 61 63 74 6c 79 20 |racter, |exactly |
|00002910| 65 71 75 69 76 61 6c 65 | 6e 74 20 74 6f 20 5b 30 |equivale|nt to [0|
|00002920| 2d 39 41 2d 5a 61 2d 7a | 5f 5d 0d 5c 57 09 09 09 |-9A-Za-z|_].\W...|
|00002930| 6d 61 74 63 68 65 73 20 | 61 20 6e 6f 6e 2d 77 6f |matches |a non-wo|
|00002940| 72 64 20 63 68 61 72 61 | 63 74 65 72 2c 20 69 65 |rd chara|cter, ie|
|00002950| 20 5b 5e 30 2d 39 41 2d | 5a 61 2d 7a 5f 5d 0d 5c | [^0-9A-|Za-z_].\|
|00002960| 3c 09 09 09 6d 61 74 63 | 68 65 73 20 74 68 65 20 |<...matc|hes the |
|00002970| 62 65 67 69 6e 6e 69 6e | 67 20 6f 66 20 61 20 77 |beginnin|g of a w|
|00002980| 6f 72 64 2e 0d 5c 3e 09 | 09 09 6d 61 74 63 68 65 |ord..\>.|..matche|
|00002990| 73 20 74 68 65 20 65 6e | 64 20 6f 66 20 61 20 77 |s the en|d of a w|
|000029a0| 6f 72 64 2e 0d 5c 62 09 | 09 09 6d 61 74 63 68 65 |ord..\b.|..matche|
|000029b0| 73 20 74 68 65 20 62 65 | 67 69 6e 6e 69 6e 67 20 |s the be|ginning |
|000029c0| 6f 72 20 65 6e 64 20 6f | 66 20 61 20 77 6f 72 64 |or end o|f a word|
|000029d0| 20 28 61 20 77 6f 72 64 | 20 62 6f 75 6e 64 61 72 | (a word| boundar|
|000029e0| 79 29 2e 0d 5c 42 09 09 | 09 6d 61 74 63 68 65 73 |y)..\B..|.matches|
|000029f0| 20 74 68 65 20 62 6f 75 | 6e 64 61 72 79 20 28 62 | the bou|ndary (b|
|00002a00| 65 67 69 6e 6e 69 6e 67 | 20 6f 72 20 65 6e 64 29 |eginning| or end)|
|00002a10| 20 6f 66 20 61 20 73 65 | 74 0d 09 09 09 6f 66 20 | of a se|t....of |
|00002a20| 6e 6f 6e 2d 77 6f 72 64 | 20 63 68 61 72 61 63 74 |non-word| charact|
|00002a30| 65 72 73 2e 0d 5c 74 09 | 09 09 6d 61 74 63 68 65 |ers..\t.|..matche|
|00002a40| 73 20 61 20 74 61 62 2e | 0d 5c 6e 09 09 09 6d 61 |s a tab.|.\n...ma|
|00002a50| 74 63 68 65 73 20 61 20 | 6e 65 77 6c 69 6e 65 20 |tches a |newline |
|00002a60| 28 74 68 65 20 52 65 74 | 75 72 6e 20 6b 65 79 29 |(the Ret|urn key)|
|00002a70| 2e 0d 72 31 20 7c 20 72 | 32 09 09 61 6c 74 65 72 |..r1 | r|2..alter|
|00002a80| 6e 61 74 69 6f 6e 3a 20 | 6d 61 74 63 68 65 73 20 |nation: |matches |
|00002a90| 65 69 74 68 65 72 20 72 | 31 20 6f 72 20 72 32 2c |either r|1 or r2,|
|00002aa0| 20 65 67 20 22 62 6c 75 | 65 7c 67 72 65 65 6e 22 | eg "blu|e|green"|
|00002ab0| 0d 72 31 72 32 09 09 63 | 6f 6e 63 61 74 65 6e 61 |.r1r2..c|oncatena|
|00002ac0| 74 69 6f 6e 3a 20 6d 61 | 74 63 68 65 73 20 72 31 |tion: ma|tches r1|
|00002ad0| 20 66 6f 6c 6c 6f 77 65 | 64 20 62 79 20 72 32 20 | followe|d by r2 |
|00002ae0| 2e 0d 72 20 2b 09 09 09 | 6d 61 74 63 68 65 73 20 |..r +...|matches |
|00002af0| 6f 6e 65 20 6f 72 20 6d | 6f 72 65 20 72 20 27 73 |one or m|ore r 's|
|00002b00| 2e 20 0d 72 20 2a 09 09 | 09 6d 61 74 63 68 65 73 |. .r *..|.matches|
|00002b10| 20 7a 65 72 6f 20 6f 72 | 20 6d 6f 72 65 20 72 20 | zero or| more r |
|00002b20| 27 73 2e 20 20 28 4e 6f | 74 65 20 74 68 61 74 20 |'s. (No|te that |
|00002b30| 7a 65 72 6f 20 72 d5 73 | 20 63 61 6e 0d 09 09 09 |zero r.s| can....|
|00002b40| 62 65 20 61 6e 79 77 68 | 65 72 65 20 69 6e 20 74 |be anywh|ere in t|
|00002b50| 68 65 20 74 65 78 74 29 | 0d 72 20 3f 09 09 09 6d |he text)|.r ?...m|
|00002b60| 61 74 63 68 65 73 20 7a | 65 72 6f 20 6f 72 20 6f |atches z|ero or o|
|00002b70| 6e 65 20 72 20 27 73 2e | 20 0d 28 20 72 20 29 09 |ne r 's.| .( r ).|
|00002b80| 09 67 72 6f 75 70 69 6e | 67 3a 20 6d 61 74 63 68 |.groupin|g: match|
|00002b90| 65 73 20 72 2e 20 50 61 | 72 65 6e 74 68 65 73 65 |es r. Pa|renthese|
|00002ba0| 73 20 68 61 76 65 20 74 | 77 6f 20 64 69 73 74 69 |s have t|wo disti|
|00002bb0| 6e 63 74 20 75 73 65 73 | 3b 0d 09 09 09 74 6f 20 |nct uses|;....to |
|00002bc0| 6f 76 65 72 72 69 64 65 | 20 64 65 66 61 75 6c 74 |override| default|
|00002bd0| 20 70 72 65 63 65 64 65 | 6e 63 65 20 6f 66 20 6d | precede|nce of m|
|00002be0| 65 74 61 63 68 61 72 61 | 63 74 65 72 20 6f 70 65 |etachara|cter ope|
|00002bf0| 72 61 74 6f 72 73 2c 20 | 61 6e 64 0d 09 09 09 74 |rators, |and....t|
|00002c00| 6f 20 74 61 67 20 61 20 | 73 75 62 65 78 70 72 65 |o tag a |subexpre|
|00002c10| 73 73 69 6f 6e 20 66 6f | 72 20 73 75 62 73 65 71 |ssion fo|r subseq|
|00002c20| 75 65 6e 74 20 72 65 66 | 65 72 65 6e 63 65 2e 0d |uent ref|erence..|
|00002c30| 5c 31 2e 2e 2e 5c 39 09 | 09 73 74 61 6e 64 20 66 |\1...\9.|.stand f|
|00002c40| 6f 72 20 77 68 61 74 65 | 76 65 72 20 74 65 78 74 |or whate|ver text|
|00002c50| 20 74 68 65 20 66 69 72 | 73 74 20 74 68 72 6f 75 | the fir|st throu|
|00002c60| 67 68 20 6e 69 6e 74 68 | 20 73 65 74 20 6f 66 0d |gh ninth| set of.|
|00002c70| 09 09 09 70 61 72 65 6e | 74 68 65 73 65 73 20 63 |...paren|theses c|
|00002c80| 75 72 72 65 6e 74 6c 79 | 20 6d 61 74 63 68 2c 20 |urrently| match, |
|00002c90| 63 6f 75 6e 74 69 6e 67 | 20 6f 70 65 6e 69 6e 67 |counting| opening|
|00002ca0| 20 70 61 72 65 6e 74 68 | 65 73 65 73 20 66 72 6f | parenth|eses fro|
|00002cb0| 6d 0d 09 09 09 6c 65 66 | 74 20 74 6f 20 72 69 67 |m....lef|t to rig|
|00002cc0| 68 74 2e 20 4e 6f 74 65 | 20 74 68 61 74 20 69 66 |ht. Note| that if|
|00002cd0| 20 74 68 65 20 70 61 69 | 72 20 6f 66 20 70 61 72 | the pai|r of par|
|00002ce0| 65 6e 74 68 65 73 65 73 | 20 68 61 73 20 61 20 2b |entheses| has a +|
|00002cf0| 20 6f 72 0d 09 09 09 2a | 20 6f 72 20 3f 20 6f 70 | or....*| or ? op|
|00002d00| 65 72 61 74 6f 72 20 61 | 66 74 65 72 20 69 74 2c |erator a|fter it,|
|00002d10| 20 74 68 65 6e 20 61 6c | 6c 20 6f 66 20 74 68 65 | then al|l of the|
|00002d20| 20 6d 61 74 63 68 65 73 | 20 61 72 65 0d 09 09 09 | matches| are....|
|00002d30| 69 6e 63 6c 75 64 65 64 | 2c 20 65 67 20 2f 28 66 |included|, eg /(f|
|00002d40| 6f 6f 29 2b 62 61 72 2f | 20 61 70 70 6c 69 65 64 |oo)+bar/| applied|
|00002d50| 20 74 6f 20 22 66 6f 6f | 66 6f 6f 66 6f 6f 62 61 | to "foo|foofooba|
|00002d60| 72 22 20 77 69 6c 6c 20 | 73 65 74 20 5c 31 0d 09 |r" will |set \1..|
|00002d70| 09 09 74 6f 20 22 66 6f | 6f 66 6f 6f 66 6f 6f 22 |..to "fo|ofoofoo"|
|00002d80| 2e 20 54 6f 20 67 65 74 | 20 6a 75 73 74 20 74 68 |. To get| just th|
|00002d90| 65 20 66 69 72 73 74 20 | 66 6f 6f 2c 20 75 73 65 |e first |foo, use|
|00002da0| 20 2f 28 66 6f 6f 29 5c | 31 2a 62 61 72 2f 20 2d | /(foo)\|1*bar/ -|
|00002db0| 0d 09 09 09 74 68 65 6e | 20 5c 31 20 69 73 20 73 |....then| \1 is s|
|00002dc0| 65 74 20 74 6f 20 22 66 | 6f 6f 22 2e 20 28 50 65 |et to "f|oo". (Pe|
|00002dd0| 72 6c 20 75 73 65 72 73 | 20 6e 6f 74 65 20 74 68 |rl users| note th|
|00002de0| 69 73 20 69 73 20 74 68 | 65 20 6f 70 70 6f 73 69 |is is th|e opposi|
|00002df0| 74 65 0d 09 09 09 6f 66 | 20 77 68 61 74 20 79 6f |te....of| what yo|
|00002e00| 75 20 61 72 65 20 75 73 | 65 64 20 74 6f 29 2e 0d |u are us|ed to)..|
|00002e10| 5c 64 64 64 09 09 69 73 | 20 69 6e 74 65 72 70 72 |\ddd..is| interpr|
|00002e20| 65 74 65 64 20 61 73 20 | 61 6e 20 6f 63 74 61 6c |eted as |an octal|
|00002e30| 20 6e 75 6d 62 65 72 2c | 20 61 73 20 69 6e 20 43 | number,| as in C|
|00002e40| 2e 20 54 68 65 20 64 69 | 67 69 74 73 0d 09 09 09 |. The di|gits....|
|00002e50| 65 78 63 6c 75 64 65 20 | 38 20 61 6e 64 20 39 2c |exclude |8 and 9,|
|00002e60| 20 6e 65 65 64 6c 65 73 | 73 20 74 6f 20 73 61 79 | needles|s to say|
|00002e70| 2c 20 61 6e 64 20 74 68 | 65 72 65 20 63 61 6e 20 |, and th|ere can |
|00002e80| 62 65 20 66 72 6f 6d 20 | 31 20 74 6f 20 33 0d 09 |be from |1 to 3..|
|00002e90| 09 09 64 69 67 69 74 73 | 20 69 6e 20 74 68 65 20 |..digits| in the |
|00002ea0| 6e 75 6d 62 65 72 2e 20 | 4e 6f 74 65 20 74 68 61 |number. |Note tha|
|00002eb0| 74 20 5c 31 20 74 68 72 | 6f 75 67 68 20 5c 37 20 |t \1 thr|ough \7 |
|00002ec0| 61 72 65 20 69 6e 74 65 | 72 70 72 65 74 65 64 0d |are inte|rpreted.|
|00002ed0| 09 09 09 61 73 20 73 75 | 62 65 78 70 72 65 73 73 |...as su|bexpress|
|00002ee0| 69 6f 6e 20 74 61 67 73 | 20 75 6e 6c 65 73 73 20 |ion tags| unless |
|00002ef0| 66 6f 6c 6c 6f 77 65 64 | 20 69 6d 6d 65 64 69 61 |followed| immedia|
|00002f00| 74 65 6c 79 20 62 79 20 | 61 6e 6f 74 68 65 72 0d |tely by |another.|
|00002f10| 09 09 09 6f 63 74 61 6c | 20 64 69 67 69 74 20 28 |...octal| digit (|
|00002f20| 65 67 20 5c 32 33 20 69 | 73 20 6e 6f 74 20 74 61 |eg \23 i|s not ta|
|00002f30| 67 20 32 20 66 6f 6c 6c | 6f 77 65 64 20 62 79 20 |g 2 foll|owed by |
|00002f40| 61 20 33 2c 20 69 74 20 | 69 73 20 74 68 65 0d 09 |a 3, it |is the..|
|00002f50| 09 09 6f 63 74 61 6c 20 | 6e 75 6d 62 65 72 20 31 |..octal |number 1|
|00002f60| 39 20 64 65 63 69 6d 61 | 6c 29 2e 20 5c 38 20 61 |9 decima|l). \8 a|
|00002f70| 6e 64 20 5c 39 20 61 72 | 65 20 61 6c 77 61 79 73 |nd \9 ar|e always|
|00002f80| 20 74 61 67 73 2c 20 73 | 69 6e 63 65 20 38 0d 09 | tags, s|ince 8..|
|00002f90| 09 09 61 6e 64 20 39 20 | 61 72 65 20 6e 6f 74 20 |..and 9 |are not |
|00002fa0| 6f 63 74 61 6c 20 6e 75 | 6d 62 65 72 73 2e 20 54 |octal nu|mbers. T|
|00002fb0| 6f 20 72 65 66 65 72 20 | 74 6f 20 6f 63 74 61 6c |o refer |to octal|
|00002fc0| 20 6e 75 6d 62 65 72 73 | 20 31 20 74 6f 20 37 2c | numbers| 1 to 7,|
|00002fd0| 0d 09 09 09 75 73 65 20 | 5c 30 31 20 74 6f 20 5c |....use |\01 to \|
|00002fe0| 30 37 2e 20 54 6f 20 66 | 6f 6c 6c 6f 77 20 61 20 |07. To f|ollow a |
|00002ff0| 74 61 67 20 77 69 74 68 | 20 61 20 6c 6f 77 20 6e |tag with| a low n|
|00003000| 75 6d 62 65 72 20 28 65 | 67 20 5c 32 0d 09 09 09 |umber (e|g \2....|
|00003010| 66 6f 6c 6c 6f 77 65 64 | 20 62 79 20 33 29 2c 20 |followed| by 3), |
|00003020| 75 73 65 20 74 68 65 20 | 6f 63 74 61 6c 20 72 65 |use the |octal re|
|00003030| 70 72 65 73 65 6e 74 61 | 74 69 6f 6e 20 6f 66 20 |presenta|tion of |
|00003040| 74 68 65 20 6e 75 6d 62 | 65 72 20 28 65 67 0d 09 |the numb|er (eg..|
|00003050| 09 09 5c 32 5c 30 36 33 | 20 2d 2d 20 5c 30 36 33 |..\2\063| -- \063|
|00003060| 20 65 71 75 61 6c 73 20 | 35 31 20 64 65 63 69 6d | equals |51 decim|
|00003070| 61 6c 2c 20 74 68 65 20 | 41 53 43 49 49 20 63 6f |al, the |ASCII co|
|00003080| 64 65 20 66 6f 72 20 33 | 29 2e 0d 0d 54 68 65 20 |de for 3|)...The |
|00003090| 6d 65 74 61 63 68 61 72 | 61 63 74 65 72 73 20 5e |metachar|acters ^|
|000030a0| 20 61 6e 64 20 24 20 74 | 6f 20 6d 61 74 63 68 20 | and $ t|o match |
|000030b0| 74 68 65 20 62 65 67 69 | 6e 6e 69 6e 67 20 61 6e |the begi|nning an|
|000030c0| 64 20 65 6e 64 20 6f 66 | 20 73 74 72 69 6e 67 73 |d end of| strings|
|000030d0| 2c 20 61 6e 64 0d 5c 62 | 20 5c 42 20 5c 3c 20 5c |, and.\b| \B \< \|
|000030e0| 3e 20 74 6f 20 6d 61 74 | 63 68 20 76 61 72 69 6f |> to mat|ch vario|
|000030f0| 75 73 20 62 6f 75 6e 64 | 61 72 69 65 73 20 64 6f |us bound|aries do|
|00003100| 6e d5 74 20 61 63 74 75 | 61 6c 6c 79 20 6d 61 74 |n.t actu|ally mat|
|00003110| 63 68 20 61 6e 79 0d 63 | 68 61 72 61 63 74 65 72 |ch any.c|haracter|
|00003120| 73 3b 20 72 61 74 68 65 | 72 20 74 68 65 79 20 66 |s; rathe|r they f|
|00003130| 6f 72 63 65 20 61 6c 69 | 67 6e 6d 65 6e 74 20 74 |orce ali|gnment t|
|00003140| 6f 20 61 20 70 61 72 74 | 69 63 75 6c 61 72 20 74 |o a part|icular t|
|00003150| 65 78 74 20 70 6f 73 69 | 74 69 6f 6e 2e 20 46 6f |ext posi|tion. Fo|
|00003160| 72 0d 65 78 61 6d 70 6c | 65 2c 20 2f 5c 62 72 75 |r.exampl|e, /\bru|
|00003170| 6e 5c 62 2f 20 77 69 6c | 6c 20 61 6c 77 61 79 73 |n\b/ wil|l always|
|00003180| 20 6d 61 74 63 68 20 6a | 75 73 74 20 d2 72 75 6e | match j|ust .run|
|00003190| d3 20 69 66 20 69 74 20 | 6d 61 74 63 68 65 73 20 |. if it |matches |
|000031a0| 61 6e 79 74 68 69 6e 67 | 2c 0d 62 75 74 20 77 69 |anything|,.but wi|
|000031b0| 6c 6c 20 6e 6f 74 20 6d | 61 74 63 68 20 22 72 75 |ll not m|atch "ru|
|000031c0| 6e 6e 65 72 22 20 6f 72 | 20 22 62 72 75 6e 74 22 |nner" or| "brunt"|
|000031d0| 2e 20 42 79 20 63 6f 6d | 70 61 72 69 73 6f 6e 2c |. By com|parison,|
|000031e0| 20 2f 5c 57 72 75 6e 5c | 57 2f 20 77 6f 6e d5 74 | /\Wrun\|W/ won.t|
|000031f0| 0d 6d 61 74 63 68 20 d2 | 72 75 6e 6e 65 72 d3 20 |.match .|runner. |
|00003200| 6f 72 20 d2 62 72 75 6e | 74 d3 20 65 69 74 68 65 |or .brun|t. eithe|
|00003210| 72 2c 20 62 75 74 20 69 | 74 20 77 69 6c 6c 20 69 |r, but i|t will i|
|00003220| 6e 63 6c 75 64 65 20 61 | 6e 79 20 6e 6f 6e d0 77 |nclude a|ny non.w|
|00003230| 6f 72 64 0d 63 68 61 72 | 61 63 74 65 72 20 74 68 |ord.char|acter th|
|00003240| 61 74 20 68 61 70 70 65 | 6e 73 20 74 6f 20 63 6f |at happe|ns to co|
|00003250| 6d 65 20 62 65 66 6f 72 | 65 20 6f 72 20 61 66 74 |me befor|e or aft|
|00003260| 65 72 20 74 68 65 20 77 | 6f 72 64 20 d2 72 75 6e |er the w|ord .run|
|00003270| d3 2e 20 4e 6f 72 6d 61 | 6c 6c 79 0d 79 6f 75 20 |.. Norma|lly.you |
|00003280| 77 6f 6e d5 74 20 77 61 | 6e 74 20 74 6f 20 69 6e |won.t wa|nt to in|
|00003290| 63 6c 75 64 65 20 6c 65 | 61 64 69 6e 67 20 6f 72 |clude le|ading or|
|000032a0| 20 74 72 61 69 6c 69 6e | 67 20 73 70 61 63 65 73 | trailin|g spaces|
|000032b0| 20 65 74 63 20 69 6e 20 | 74 68 65 20 6d 61 74 63 | etc in |the matc|
|000032c0| 68 2e 0d 0d 50 61 72 65 | 6e 74 68 65 73 65 73 20 |h...Pare|ntheses |
|000032d0| 28 29 20 68 61 76 65 20 | 74 68 65 20 68 69 67 68 |() have |the high|
|000032e0| 65 73 74 20 70 72 65 63 | 65 64 65 6e 63 65 2c 20 |est prec|edence, |
|000032f0| 61 6c 6c 6f 77 69 6e 67 | 20 79 6f 75 20 74 6f 20 |allowing| you to |
|00003300| 6f 76 65 72 72 69 64 65 | 0d 64 65 66 61 75 6c 74 |override|.default|
|00003310| 20 70 72 65 63 65 64 65 | 6e 63 65 20 77 68 65 6e | precede|nce when|
|00003320| 20 6e 65 65 64 65 64 2e | 20 54 68 65 20 d2 72 65 | needed.| The .re|
|00003330| 70 65 74 69 74 69 6f 6e | d3 20 6f 70 65 72 61 74 |petition|. operat|
|00003340| 6f 72 73 20 2a 20 2b 20 | 3f 20 68 61 76 65 20 74 |ors * + |? have t|
|00003350| 68 65 0d 6e 65 78 74 d0 | 68 69 67 68 65 73 74 20 |he.next.|highest |
|00003360| 70 72 65 63 65 64 65 6e | 63 65 2c 20 66 6f 6c 6c |preceden|ce, foll|
|00003370| 6f 77 65 64 20 62 79 20 | 63 6f 6e 63 61 74 65 6e |owed by |concaten|
|00003380| 61 74 69 6f 6e 2c 20 77 | 69 74 68 20 61 6c 74 65 |ation, w|ith alte|
|00003390| 72 6e 61 74 69 6f 6e 0d | 68 61 76 69 6e 67 20 74 |rnation.|having t|
|000033a0| 68 65 20 6c 6f 77 65 73 | 74 20 70 72 65 63 65 64 |he lowes|t preced|
|000033b0| 65 6e 63 65 20 6f 66 20 | 61 6c 6c 2e 20 46 6f 72 |ence of |all. For|
|000033c0| 20 65 78 61 6d 70 6c 65 | 2c 20 69 6e 20 61 62 63 | example|, in abc|
|000033d0| 2a 64 20 74 68 65 20 2a | 20 61 70 70 6c 69 65 73 |*d the *| applies|
|000033e0| 0d 6f 6e 6c 79 20 74 6f | 20 74 68 65 20 63 20 73 |.only to| the c s|
|000033f0| 69 6e 63 65 20 74 68 65 | 20 72 65 70 65 74 69 74 |ince the| repetit|
|00003400| 69 6f 6e 20 6f 70 65 72 | 61 74 6f 72 20 61 63 74 |ion oper|ator act|
|00003410| 73 20 62 65 66 6f 72 65 | 20 63 6f 6e 63 61 74 65 |s before| concate|
|00003420| 6e 61 74 69 6f 6e 2c 20 | 61 6e 64 0d 69 6e 20 61 |nation, |and.in a|
|00003430| 62 64 7c 64 65 66 20 74 | 68 65 20 7c 20 61 70 70 |bd|def t|he | app|
|00003440| 6c 69 65 73 20 74 6f 20 | 61 62 64 20 61 6e 64 20 |lies to |abd and |
|00003450| 64 65 66 20 73 69 6e 63 | 65 20 63 6f 6e 63 61 74 |def sinc|e concat|
|00003460| 65 6e 61 74 69 6f 6e 20 | 62 69 6e 64 73 20 74 68 |enation |binds th|
|00003470| 65 6d 0d 74 6f 67 65 74 | 68 65 72 20 69 6e 74 6f |em.toget|her into|
|00003480| 20 6c 69 74 74 6c 65 20 | 67 72 6f 75 70 73 20 6f | little |groups o|
|00003490| 66 20 74 68 72 65 65 20 | 62 65 66 6f 72 65 20 61 |f three |before a|
|000034a0| 6c 74 65 72 6e 61 74 69 | 6f 6e 20 63 61 6e 20 70 |lternati|on can p|
|000034b0| 6c 61 79 2e 0d 0d 52 65 | 67 75 6c 61 72 20 65 78 |lay...Re|gular ex|
|000034c0| 70 72 65 73 73 69 6f 6e | 20 63 61 6e 20 62 65 20 |pression| can be |
|000034d0| 75 73 65 64 20 74 6f 20 | 6a 75 73 74 20 6c 6f 63 |used to |just loc|
|000034e0| 61 74 65 20 61 6e 20 69 | 6e 73 74 61 6e 63 65 20 |ate an i|nstance |
|000034f0| 6f 66 20 61 0d 70 61 74 | 74 65 72 6e 2c 20 61 73 |of a.pat|tern, as|
|00003500| 20 69 6e 0d 09 24 30 20 | 7e 20 2f 65 78 74 65 72 | in..$0 |~ /exter|
|00003510| 6e 2f 0d 62 75 74 20 74 | 68 65 79 20 63 61 6e 20 |n/.but t|hey can |
|00003520| 61 6c 73 6f 20 62 65 20 | 75 73 65 64 20 74 6f 20 |also be |used to |
|00003530| 73 70 65 63 69 66 79 20 | 74 65 78 74 20 66 6f 72 |specify |text for|
|00003540| 20 72 65 70 6c 61 63 65 | 6d 65 6e 74 2c 20 62 79 | replace|ment, by|
|00003550| 20 75 73 69 6e 67 20 74 | 68 65 0d d2 73 75 62 d3 | using t|he..sub.|
|00003560| 20 61 6e 64 20 d2 67 73 | 75 62 d3 20 66 75 6e 63 | and .gs|ub. func|
|00003570| 74 69 6f 6e 73 2e 20 4c | 6f 6f 6b 69 6e 67 20 61 |tions. L|ooking a|
|00003580| 68 65 61 64 20 6a 75 73 | 74 20 61 20 62 69 74 2c |head jus|t a bit,|
|00003590| 20 74 68 65 73 65 20 66 | 75 6e 63 74 69 6f 6e 73 | these f|unctions|
|000035a0| 20 74 61 6b 65 0d 61 20 | 72 65 67 75 6c 61 72 20 | take.a |regular |
|000035b0| 65 78 70 72 65 73 73 69 | 6f 6e 20 61 73 20 74 68 |expressi|on as th|
|000035c0| 65 20 66 69 72 73 74 20 | 61 72 67 75 6d 65 6e 74 |e first |argument|
|000035d0| 2c 20 74 68 65 20 73 74 | 72 69 6e 67 20 74 6f 20 |, the st|ring to |
|000035e0| 75 73 65 20 66 6f 72 0d | 72 65 70 6c 61 63 65 6d |use for.|replacem|
|000035f0| 65 6e 74 20 61 73 20 74 | 68 65 20 73 65 63 6f 6e |ent as t|he secon|
|00003600| 64 20 61 72 67 75 6d 65 | 6e 74 2c 20 61 6e 64 20 |d argume|nt, and |
|00003610| 74 68 65 20 73 74 72 69 | 6e 67 20 74 6f 20 64 6f |the stri|ng to do|
|00003620| 20 74 68 65 20 73 65 61 | 72 63 68 20 61 6e 64 0d | the sea|rch and.|
|00003630| 72 65 70 6c 61 63 65 20 | 69 6e 20 61 73 20 74 68 |replace |in as th|
|00003640| 65 20 74 68 69 72 64 20 | 61 72 67 75 6d 65 6e 74 |e third |argument|
|00003650| 2c 20 77 69 74 68 20 24 | 30 20 75 73 65 64 20 62 |, with $|0 used b|
|00003660| 79 20 64 65 66 61 75 6c | 74 20 69 66 20 74 68 65 |y defaul|t if the|
|00003670| 72 65 20 69 73 20 6e 6f | 0d 74 68 69 72 64 20 61 |re is no|.third a|
|00003680| 72 67 75 6d 65 6e 74 2e | 20 d2 73 75 62 d3 20 64 |rgument.| .sub. d|
|00003690| 6f 65 73 20 61 20 73 69 | 6e 67 6c 65 20 73 75 62 |oes a si|ngle sub|
|000036a0| 73 74 69 74 75 74 69 6f | 6e 20 6f 6e 20 74 68 65 |stitutio|n on the|
|000036b0| 20 74 65 78 74 2c 20 61 | 6e 64 20 d2 67 73 75 62 | text, a|nd .gsub|
|000036c0| d3 0d 64 6f 65 73 20 61 | 6c 6c 20 70 6f 73 73 69 |..does a|ll possi|
|000036d0| 62 6c 65 20 6e 6f 6e 2d | 6f 76 65 72 6c 61 70 70 |ble non-|overlapp|
|000036e0| 69 6e 67 20 73 75 62 73 | 74 69 74 75 74 69 6f 6e |ing subs|titution|
|000036f0| 73 2e 20 57 69 74 68 69 | 6e 20 74 68 65 20 72 65 |s. Withi|n the re|
|00003700| 70 6c 61 63 65 6d 65 6e | 74 0d 73 74 72 69 6e 67 |placemen|t.string|
|00003710| 73 20 6f 66 20 74 68 65 | 73 65 20 66 75 6e 63 74 |s of the|se funct|
|00003720| 69 6f 6e 73 2c 20 79 6f | 75 20 63 61 6e 20 75 73 |ions, yo|u can us|
|00003730| 65 20 5c 31 20 74 68 72 | 6f 75 67 68 20 5c 39 20 |e \1 thr|ough \9 |
|00003740| 74 6f 20 72 65 66 65 72 | 20 74 6f 20 74 65 78 74 |to refer| to text|
|00003750| 0d 63 75 72 72 65 6e 74 | 6c 79 20 6d 61 74 63 68 |.current|ly match|
|00003760| 65 64 20 62 79 20 74 61 | 67 67 65 64 20 73 75 62 |ed by ta|gged sub|
|00003770| 65 78 70 72 65 73 73 69 | 6f 6e 73 2c 20 61 6e 64 |expressi|ons, and|
|00003780| 20 74 68 65 20 61 6d 70 | 65 72 73 61 6e 64 20 d2 | the amp|ersand .|
|00003790| 26 d3 20 73 74 61 6e 64 | 73 0d 66 6f 72 20 61 6c |&. stand|s.for al|
|000037a0| 6c 20 6f 66 20 74 68 65 | 20 74 65 78 74 20 74 68 |l of the| text th|
|000037b0| 61 74 20 77 61 73 20 6d | 61 74 63 68 65 64 2e 20 |at was m|atched. |
|000037c0| 54 6f 20 70 75 74 20 61 | 20 70 6c 61 69 6e 20 61 |To put a| plain a|
|000037d0| 6d 70 65 72 73 61 6e 64 | 20 69 6e 20 74 68 65 0d |mpersand| in the.|
|000037e0| 72 65 70 6c 61 63 65 6d | 65 6e 74 2c 20 75 73 65 |replacem|ent, use|
|000037f0| 20 d2 5c 26 d3 2e 0d 0d | 41 74 20 74 68 69 73 20 | .\&....|At this |
|00003800| 70 6f 69 6e 74 20 73 6f | 6d 65 20 63 6f 6e 73 69 |point so|me consi|
|00003810| 64 65 72 61 62 6c 65 20 | 65 78 61 6d 70 6c 69 6e |derable |examplin|
|00003820| 67 20 75 73 75 61 6c 6c | 79 20 68 65 6c 70 73 3a |g usuall|y helps:|
|00003830| 0d 54 68 65 20 71 75 69 | 63 6b 20 62 72 6f 77 6e |.The qui|ck brown|
|00003840| 09 09 09 6d 61 74 63 68 | 65 73 20 6a 75 73 74 20 |...match|es just |
|00003850| 74 68 61 74 2c 20 22 54 | 68 65 20 71 75 69 63 6b |that, "T|he quick|
|00003860| 20 62 72 6f 77 6e 22 2e | 20 4e 6f 74 65 20 69 74 | brown".| Note it|
|00003870| 0d 09 09 09 09 09 09 77 | 6f 75 6c 64 20 6d 61 74 |.......w|ould mat|
|00003880| 63 68 20 22 54 68 65 20 | 71 75 69 63 6b 20 62 72 |ch "The |quick br|
|00003890| 6f 77 6e 22 20 69 6e 20 | 22 54 68 65 20 71 75 69 |own" in |"The qui|
|000038a0| 63 6b 20 62 72 6f 77 6e | 69 65 22 2e 0d 72 65 64 |ck brown|ie"..red|
|000038b0| 20 66 6f 78 5c 2e 09 09 | 09 09 6d 61 74 63 68 65 | fox\...|..matche|
|000038c0| 73 20 22 72 65 64 20 66 | 6f 78 2e 22 20 28 74 68 |s "red f|ox." (th|
|000038d0| 65 20 70 65 72 69 6f 64 | 20 6d 75 73 74 20 62 65 |e period| must be|
|000038e0| 0d 09 09 09 09 09 09 65 | 73 63 61 70 65 64 20 66 |.......e|scaped f|
|000038f0| 6f 72 20 61 20 6c 69 74 | 65 72 61 6c 20 6d 61 74 |or a lit|eral mat|
|00003900| 63 68 29 2e 0d 5b 20 5c | 74 5d 09 09 09 09 09 6d |ch)..[ \|t].....m|
|00003910| 61 74 63 68 65 73 20 61 | 20 73 69 6e 67 6c 65 20 |atches a| single |
|00003920| 73 70 61 63 65 20 6f 72 | 20 74 61 62 0d 09 09 09 |space or| tab....|
|00003930| 09 09 09 28 74 68 61 74 | d5 73 20 61 20 73 70 61 |...(that|.s a spa|
|00003940| 63 65 20 62 65 66 6f 72 | 65 20 74 68 65 20 5c 29 |ce befor|e the \)|
|00003950| 2e 0d 5b 20 5c 74 5d 2b | 09 09 09 09 09 6d 61 74 |..[ \t]+|.....mat|
|00003960| 63 68 65 73 20 61 6e 79 | 20 63 6f 6e 73 65 63 75 |ches any| consecu|
|00003970| 74 69 76 65 20 72 75 6e | 20 6f 66 20 73 70 61 63 |tive run| of spac|
|00003980| 65 73 20 61 6e 64 20 74 | 61 62 73 0d 09 09 09 09 |es and t|abs.....|
|00003990| 09 09 69 6e 20 61 6e 79 | 20 6d 69 78 2e 0d 5b 30 |..in any| mix..[0|
|000039a0| 2d 39 5d 2b 09 09 09 09 | 09 6d 61 74 63 68 65 73 |-9]+....|.matches|
|000039b0| 20 61 6e 20 69 6e 74 65 | 67 65 72 20 28 72 65 61 | an inte|ger (rea|
|000039c0| 64 20 d2 6f 6e 65 20 6f | 72 20 6d 6f 72 65 20 64 |d .one o|r more d|
|000039d0| 69 67 69 74 73 d3 29 0d | 5b 2b 2d 5d 3f 5b 30 2d |igits.).|[+-]?[0-|
|000039e0| 39 5d 2b 09 09 09 09 6d | 61 74 63 68 65 73 20 61 |9]+....m|atches a|
|000039f0| 6e 20 69 6e 74 65 67 65 | 72 2c 20 74 6f 67 65 74 |n intege|r, toget|
|00003a00| 68 65 72 20 77 69 74 68 | 20 61 6e 79 20 70 72 65 |her with| any pre|
|00003a10| 63 65 64 69 6e 67 20 73 | 69 67 6e 2e 0d 5b 41 2d |ceding s|ign..[A-|
|00003a20| 5a 61 2d 7a 5d 2b 09 09 | 09 09 6d 61 74 63 68 65 |Za-z]+..|..matche|
|00003a30| 73 20 61 6e 20 45 6e 67 | 6c 69 73 68 20 77 6f 72 |s an Eng|lish wor|
|00003a40| 64 20 28 75 6e 68 79 70 | 68 65 6e 61 74 65 64 29 |d (unhyp|henated)|
|00003a50| 2e 0d 68 6f 75 73 65 73 | 3f 09 09 09 09 09 6d 61 |..houses|?.....ma|
|00003a60| 74 63 68 65 73 20 22 68 | 6f 75 73 65 22 20 6f 72 |tches "h|ouse" or|
|00003a70| 20 22 68 6f 75 73 65 73 | 22 2e 0d 6d 28 69 73 73 | "houses|"..m(iss|
|00003a80| 29 2a 69 70 70 69 09 09 | 09 09 6d 61 74 63 68 65 |)*ippi..|..matche|
|00003a90| 73 20 22 6d 69 70 70 69 | 22 2c 20 22 6d 69 73 73 |s "mippi|", "miss|
|00003aa0| 69 70 70 69 22 2c 20 22 | 6d 69 73 73 69 73 73 69 |ippi", "|mississi|
|00003ab0| 70 70 69 22 2c 0d 09 09 | 09 09 09 09 22 6d 69 73 |ppi",...|...."mis|
|00003ac0| 73 69 73 73 69 73 73 69 | 70 70 69 22 2c 20 65 74 |sississi|ppi", et|
|00003ad0| 63 2e 0d 61 72 2a 67 09 | 09 09 09 09 6d 61 74 63 |c..ar*g.|....matc|
|00003ae0| 68 65 73 20 22 61 67 22 | 2c 20 22 61 72 67 22 2c |hes "ag"|, "arg",|
|00003af0| 20 22 61 72 72 67 22 2c | 20 22 61 72 72 72 67 22 | "arrg",| "arrrg"|
|00003b00| 2c 20 65 74 63 2e 0d 4d | 79 46 75 6e 63 74 69 6f |, etc..M|yFunctio|
|00003b10| 6e 5c 28 09 09 09 6d 61 | 74 63 68 65 73 20 22 4d |n\(...ma|tches "M|
|00003b20| 79 46 75 6e 63 74 69 6f | 6e 28 22 2e 0d 61 72 72 |yFunctio|n("..arr|
|00003b30| 61 79 5c 5b 69 6e 64 65 | 78 5c 5d 09 09 09 6d 61 |ay\[inde|x\]...ma|
|00003b40| 74 63 68 65 73 20 22 61 | 72 72 61 79 5b 69 6e 64 |tches "a|rray[ind|
|00003b50| 65 78 5d 22 2e 0d 61 72 | 72 61 79 5c 5b 2e 2b 5c |ex]"..ar|ray\[.+\|
|00003b60| 5d 09 09 09 09 6d 61 74 | 63 68 65 73 20 22 61 72 |]....mat|ches "ar|
|00003b70| 72 61 79 5b 69 5d 22 2c | 20 22 61 72 72 61 79 5b |ray[i]",| "array[|
|00003b80| 6a 5d 22 2c 20 22 61 72 | 72 61 79 5b 32 2a 71 2d |j]", "ar|ray[2*q-|
|00003b90| 31 5d 22 2c 20 65 74 63 | 2e 0d 5c 5c 28 5b 30 2d |1]", etc|..\\([0-|
|00003ba0| 37 5d 7c 5b 30 2d 37 5d | 5b 30 2d 37 5d 29 09 6d |7]|[0-7]|[0-7]).m|
|00003bb0| 61 74 63 68 65 73 20 22 | 5c 64 22 20 6f 72 20 22 |atches "|\d" or "|
|00003bc0| 5c 64 64 22 20 77 68 65 | 72 65 20 64 20 69 73 20 |\dd" whe|re d is |
|00003bd0| 61 6e 20 6f 63 74 61 6c | 20 64 69 67 69 74 2e 0d |an octal| digit..|
|00003be0| 28 5b 5e 5c 5c 5d 3f 7c | 28 5c 5c 5c 5c 29 2b 29 |([^\\]?||(\\\\)+)|
|00003bf0| 22 09 09 28 68 6f 72 72 | 6f 72 73 2c 20 62 65 20 |"..(horr|ors, be |
|00003c00| 62 72 61 76 65 29 20 6d | 61 74 63 68 65 73 20 61 |brave) m|atches a|
|00003c10| 6e 20 75 6e 65 73 63 61 | 70 65 64 20 71 75 6f 74 |n unesca|ped quot|
|00003c20| 65 20 6f 72 0d 09 09 09 | 09 09 09 61 20 71 75 6f |e or....|...a quo|
|00003c30| 74 65 20 70 72 65 63 65 | 64 65 64 20 62 79 20 61 |te prece|ded by a|
|00003c40| 6e 20 65 76 65 6e 20 6e | 75 6d 62 65 72 20 6f 66 |n even n|umber of|
|00003c50| 0d 09 09 09 09 09 09 62 | 61 63 6b 73 6c 61 73 68 |.......b|ackslash|
|00003c60| 65 73 d1 69 6e 20 6f 74 | 68 65 72 20 77 6f 72 64 |es.in ot|her word|
|00003c70| 73 20 61 20 74 72 75 65 | 20 71 75 6f 74 65 20 69 |s a true| quote i|
|00003c80| 6e 20 43 2e 20 54 68 65 | 0d 09 09 09 09 09 09 62 |n C. The|.......b|
|00003c90| 61 63 6b 73 6c 61 73 68 | 20 69 73 20 61 20 6d 65 |ackslash| is a me|
|00003ca0| 74 61 63 68 61 72 61 63 | 74 65 72 2c 20 73 6f 20 |tacharac|ter, so |
|00003cb0| 6d 61 74 63 68 69 6e 67 | 20 6f 6e 65 0d 09 09 09 |matching| one....|
|00003cc0| 09 09 09 6c 69 74 65 72 | 61 6c 6c 79 20 72 65 71 |...liter|ally req|
|00003cd0| 75 69 72 65 73 20 61 20 | 62 61 63 6b 73 6c 61 73 |uires a |backslas|
|00003ce0| 68 20 62 65 66 6f 72 65 | 20 74 68 65 0d 09 09 09 |h before| the....|
|00003cf0| 09 09 09 62 61 63 6b 73 | 6c 61 73 68 2e 0d 54 68 |...backs|lash..Th|
|00003d00| 65 5b 20 5c 74 5d 2b 71 | 75 69 63 6b 5b 20 5c 74 |e[ \t]+q|uick[ \t|
|00003d10| 5d 2b 62 72 6f 77 6e 09 | 6d 61 74 63 68 65 73 20 |]+brown.|matches |
|00003d20| 22 54 68 65 20 71 75 69 | 63 6b 20 62 72 6f 77 6e |"The qui|ck brown|
|00003d30| 22 20 77 69 74 68 20 76 | 61 72 69 61 62 6c 65 0d |" with v|ariable.|
|00003d40| 09 09 09 09 09 09 09 73 | 70 61 63 65 73 20 61 6e |.......s|paces an|
|00003d50| 64 20 74 61 62 73 20 62 | 65 74 77 65 65 6e 20 74 |d tabs b|etween t|
|00003d60| 68 65 20 77 6f 72 64 73 | 2e 0d 5c 2f 5c 2a 09 09 |he words|..\/\*..|
|00003d70| 09 09 09 6d 61 74 63 68 | 65 73 20 74 68 65 20 73 |...match|es the s|
|00003d80| 74 61 72 74 20 6f 66 20 | 61 20 43 20 63 6f 6d 6d |tart of |a C comm|
|00003d90| 65 6e 74 2c 20 22 2f 20 | 2a 22 2e 20 54 68 65 0d |ent, "/ |*". The.|
|00003da0| 09 09 09 09 09 09 66 6f | 72 77 61 72 64 20 73 6c |......fo|rward sl|
|00003db0| 61 73 68 20 69 73 20 65 | 73 63 61 70 65 64 20 73 |ash is e|scaped s|
|00003dc0| 6f 20 74 68 61 74 20 79 | 6f 75 20 63 61 6e 20 70 |o that y|ou can p|
|00003dd0| 6c 61 63 65 20 74 68 65 | 0d 09 09 09 09 09 09 77 |lace the|.......w|
|00003de0| 68 6f 6c 65 20 72 65 67 | 75 6c 61 72 20 65 78 70 |hole reg|ular exp|
|00003df0| 72 65 73 73 69 6f 6e 20 | 69 6e 73 69 64 65 20 66 |ression |inside f|
|00003e00| 6f 72 77 61 72 64 20 73 | 6c 61 73 68 65 73 2e 0d |orward s|lashes..|
|00003e10| 09 09 09 09 09 09 54 68 | 65 20 65 73 63 61 70 65 |......Th|e escape|
|00003e20| 20 62 65 66 6f 72 65 20 | 27 2f 27 20 77 6f 75 6c | before |'/' woul|
|00003e30| 64 20 6e 6f 74 20 62 65 | 20 6e 65 65 64 65 64 20 |d not be| needed |
|00003e40| 69 66 20 79 6f 75 0d 09 | 09 09 09 09 09 70 6c 61 |if you..|.....pla|
|00003e50| 63 65 64 20 74 68 65 20 | 65 78 70 72 65 73 73 69 |ced the |expressi|
|00003e60| 6f 6e 20 69 6e 73 69 64 | 65 20 71 75 6f 74 65 73 |on insid|e quotes|
|00003e70| 2c 20 62 75 74 20 74 68 | 65 6e 20 79 6f 75 0d 09 |, but th|en you..|
|00003e80| 09 09 09 09 09 77 6f 75 | 6c 64 20 6e 65 65 64 20 |.....wou|ld need |
|00003e90| 74 77 6f 20 65 73 63 61 | 70 65 73 20 62 65 66 6f |two esca|pes befo|
|00003ea0| 72 65 20 74 68 65 20 27 | 2a 27 2c 20 69 65 20 22 |re the '|*', ie "|
|00003eb0| 2f 5c 5c 2a 22 2e 0d 5c | 2f 5c 2a 2e 2a 5c 2a 5c |/\\*"..\|/\*.*\*\|
|00003ec0| 2f 09 09 09 09 6d 61 74 | 63 68 65 73 20 61 6c 6c |/....mat|ches all|
|00003ed0| 20 6f 66 20 61 20 6f 6e | 65 d0 6c 69 6e 65 20 43 | of a on|e.line C|
|00003ee0| 20 63 6f 6d 6d 65 6e 74 | 2c 0d 09 09 09 09 09 09 | comment|,.......|
|00003ef0| 22 2f 20 2a 20 2d 20 61 | 6e 79 74 68 69 6e 67 20 |"/ * - a|nything |
|00003f00| 2d 20 2a 20 2f 22 2e 0d | 5e 5a 09 09 09 09 09 09 |- * /"..|^Z......|
|00003f10| 6d 61 74 63 68 65 73 20 | 61 20 27 5a 27 20 61 74 |matches |a 'Z' at|
|00003f20| 20 74 68 65 20 62 65 67 | 69 6e 6e 69 6e 67 20 6f | the beg|inning o|
|00003f30| 66 20 61 20 73 74 72 69 | 6e 67 2e 0d 5e 2e 09 09 |f a stri|ng..^...|
|00003f40| 09 09 09 09 6d 61 74 63 | 68 65 73 20 74 68 65 20 |....matc|hes the |
|00003f50| 66 69 72 73 74 20 63 68 | 61 72 61 63 74 65 72 20 |first ch|aracter |
|00003f60| 6f 66 20 61 20 73 74 72 | 69 6e 67 2e 0d 2e 24 09 |of a str|ing...$.|
|00003f70| 09 09 09 09 09 6d 61 74 | 63 68 65 73 20 74 68 65 |.....mat|ches the|
|00003f80| 20 6c 61 73 74 20 63 68 | 61 72 61 63 74 65 72 20 | last ch|aracter |
|00003f90| 6f 66 20 61 20 73 74 72 | 69 6e 67 2e 0d 5e 2e 2a |of a str|ing..^.*|
|00003fa0| 24 09 09 09 09 09 6d 61 | 74 63 68 65 73 20 61 6e |$.....ma|tches an|
|00003fb0| 79 20 73 74 72 69 6e 67 | 20 63 6f 6d 70 6c 65 74 |y string| complet|
|00003fc0| 65 6c 79 20 28 61 6e 64 | 20 69 73 20 74 68 65 72 |ely (and| is ther|
|00003fd0| 65 66 6f 72 65 20 75 73 | 65 6c 65 73 73 29 2e 0d |efore us|eless)..|
|00003fe0| 5e 41 2e 2e 24 09 09 09 | 09 09 6d 61 74 63 68 65 |^A..$...|..matche|
|00003ff0| 73 20 61 6e 79 20 73 74 | 72 69 6e 67 20 77 68 69 |s any st|ring whi|
|00004000| 63 68 20 69 73 20 74 68 | 72 65 65 20 63 68 61 72 |ch is th|ree char|
|00004010| 61 63 74 65 72 73 20 6c | 6f 6e 67 2c 0d 09 09 09 |acters l|ong,....|
|00004020| 09 09 09 74 68 65 20 66 | 69 72 73 74 20 62 65 69 |...the f|irst bei|
|00004030| 6e 67 20 61 6e 20 27 41 | 27 2e 0d 5e 28 41 7c 42 |ng an 'A|'..^(A|B|
|00004040| 29 2e 2a 09 09 09 09 6d | 61 74 63 68 65 73 20 61 |).*....m|atches a|
|00004050| 6c 6c 20 6f 66 20 61 6e | 79 20 73 74 72 69 6e 67 |ll of an|y string|
|00004060| 20 74 68 61 74 20 62 65 | 67 69 6e 73 20 77 69 74 | that be|gins wit|
|00004070| 68 20 27 41 27 20 6f 72 | 20 27 42 27 2e 0d 5e 5b |h 'A' or| 'B'..^[|
|00004080| 41 42 5d 2e 2a 09 09 09 | 09 09 64 6f 65 73 20 6c |AB].*...|..does l|
|00004090| 69 6b 65 77 69 73 65 2e | 0d 5c 77 2b 09 09 09 09 |ikewise.|.\w+....|
|000040a0| 09 09 6d 61 74 63 68 65 | 73 20 61 20 43 20 74 65 |..matche|s a C te|
|000040b0| 72 6d 2c 20 6f 72 20 69 | 6e 74 65 67 65 72 20 63 |rm, or i|nteger c|
|000040c0| 6f 6e 73 74 61 6e 74 2e | 0d 28 28 2d 3e 29 7c 28 |onstant.|.((->)|(|
|000040d0| 5c 2e 29 29 28 6d 65 6d | 5c 62 29 09 09 6d 61 74 |\.))(mem|\b)..mat|
|000040e0| 63 68 65 73 20 d2 6d 65 | 6d d3 20 77 68 65 6e 20 |ches .me|m. when |
|000040f0| 69 74 20 69 73 20 69 6d | 6d 65 64 69 61 74 65 6c |it is im|mediatel|
|00004100| 79 20 70 72 65 63 65 64 | 65 64 20 62 79 20 d2 2d |y preced|ed by .-|
|00004110| 3e d3 0d 09 09 09 09 09 | 09 6f 72 20 d2 2e d3 2c |>.......|.or ...,|
|00004120| 20 61 6e 64 20 69 73 20 | 6e 6f 74 20 74 68 65 20 | and is |not the |
|00004130| 62 65 67 69 6e 6e 69 6e | 67 20 6f 66 20 61 20 6c |beginnin|g of a l|
|00004140| 6f 6e 67 65 72 20 77 6f | 72 64 2e 0d 09 09 09 09 |onger wo|rd......|
|00004150| 09 09 46 6f 72 20 72 65 | 70 6c 61 63 65 6d 65 6e |..For re|placemen|
|00004160| 74 20 70 75 72 70 6f 73 | 65 73 20 69 6e 20 61 20 |t purpos|es in a |
|00004170| d2 73 75 62 d3 20 6f 72 | 20 d2 67 73 75 62 d3 2c |.sub. or| .gsub.,|
|00004180| 20 74 68 65 0d 09 09 09 | 09 09 09 70 61 72 74 20 | the....|...part |
|00004190| 62 65 66 6f 72 65 20 d2 | 6d 65 6d d3 20 69 73 20 |before .|mem. is |
|000041a0| 67 69 76 65 6e 20 62 79 | 20 5c 31 2c 20 61 6e 64 |given by| \1, and|
|000041b0| 20 6d 65 6d 20 69 74 73 | 65 6c 66 0d 09 09 09 09 | mem its|elf.....|
|000041c0| 09 09 69 73 20 5c 34 2e | 0d 67 73 75 62 28 2f 28 |..is \4.|.gsub(/(|
|000041d0| 28 2d 3e 29 7c 28 5c 2e | 29 29 28 6d 65 6d 5c 62 |(->)|(\.|))(mem\b|
|000041e0| 29 2f 2c 20 22 5c 31 5c | 34 62 65 72 22 29 20 77 |)/, "\1\|4ber") w|
|000041f0| 69 6c 6c 20 74 75 72 6e | 20 d2 2d 3e 6d 65 6d d3 |ill turn| .->mem.|
|00004200| 20 69 6e 74 6f 20 d2 2d | 3e 6d 65 6d 62 65 72 d3 | into .-|>member.|
|00004210| 0d 09 09 09 09 09 09 61 | 6e 64 20 d2 2e 6d 65 6d |.......a|nd ..mem|
|00004220| d3 20 69 6e 74 6f 20 d2 | 2e 6d 65 6d 62 65 72 d3 |. into .|.member.|
|00004230| 20 65 76 65 72 79 77 68 | 65 72 65 20 69 6e 20 74 | everywh|ere in t|
|00004240| 68 65 0d 09 09 09 09 09 | 09 63 75 72 72 65 6e 74 |he......|.current|
|00004250| 20 69 6e 70 75 74 20 6c | 69 6e 65 20 24 30 2c 20 | input l|ine $0, |
|00004260| 69 67 6e 6f 72 69 6e 67 | 20 74 68 69 6e 67 73 20 |ignoring| things |
|00004270| 6c 69 6b 65 0d 09 09 09 | 09 09 09 d2 72 65 6d 65 |like....|....reme|
|00004280| 6d 62 65 72 d3 20 6f 72 | 20 d2 2d 3e 6d 65 6d 6f |mber. or| .->memo|
|00004290| 72 69 65 73 d3 2e 0d 67 | 73 75 62 28 2f 5c 62 46 |ries...g|sub(/\bF|
|000042a0| 75 6e 63 4e 61 6d 65 28 | 5b 20 5c 74 5d 2a 5c 28 |uncName(|[ \t]*\(|
|000042b0| 29 2f 2c 20 22 46 75 6e | 63 74 69 6f 6e 4e 61 6d |)/, "Fun|ctionNam|
|000042c0| 65 5c 31 22 29 20 77 69 | 6c 6c 20 72 65 70 6c 61 |e\1") wi|ll repla|
|000042d0| 63 65 20 d2 46 75 6e 63 | 4e 61 6d 65 d3 20 62 79 |ce .Func|Name. by|
|000042e0| 0d 09 09 09 09 09 09 d2 | 46 75 6e 63 74 69 6f 6e |........|Function|
|000042f0| 4e 61 6d 65 d3 20 65 76 | 65 72 79 77 68 65 72 65 |Name. ev|erywhere|
|00004300| 20 69 6e 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 | in the |current |
|00004310| 69 6e 70 75 74 0d 09 09 | 09 09 09 09 6c 69 6e 65 |input...|....line|
|00004320| 20 24 30 2c 20 70 72 6f | 76 69 64 65 64 20 69 74 | $0, pro|vided it|
|00004330| 20 69 73 20 66 6f 6c 6c | 6f 77 65 64 20 6f 6e 20 | is foll|owed on |
|00004340| 74 68 65 20 73 61 6d 65 | 20 6c 69 6e 65 0d 09 09 |the same| line...|
|00004350| 09 09 09 09 62 79 20 61 | 6e 20 6f 70 65 6e 69 6e |....by a|n openin|
|00004360| 67 20 70 61 72 65 6e 74 | 68 65 73 69 73 2c 20 77 |g parent|hesis, w|
|00004370| 69 74 68 20 6f 70 74 69 | 6f 6e 61 6c 20 73 70 61 |ith opti|onal spa|
|00004380| 63 65 73 20 6f 72 0d 09 | 09 09 09 09 09 74 61 62 |ces or..|.....tab|
|00004390| 73 20 62 65 74 77 65 65 | 6e 20 74 68 65 20 6e 61 |s betwee|n the na|
|000043a0| 6d 65 20 61 6e 64 20 d2 | 28 d3 2e 20 54 68 65 20 |me and .|(.. The |
|000043b0| 6d 61 74 63 68 20 65 78 | 74 65 6e 64 73 0d 09 09 |match ex|tends...|
|000043c0| 09 09 09 09 66 72 6f 6d | 20 74 68 65 20 d2 46 d3 |....from| the .F.|
|000043d0| 20 6f 66 20 d2 46 75 6e | 63 4e 61 6d 65 d3 20 75 | of .Fun|cName. u|
|000043e0| 70 20 74 6f 20 61 6e 64 | 20 69 6e 63 6c 75 64 69 |p to and| includi|
|000043f0| 6e 67 20 74 68 65 0d 09 | 09 09 09 09 09 d2 28 d3 |ng the..|......(.|
|00004400| 2c 20 73 6f 20 74 68 65 | 20 d2 28 d3 20 61 6e 64 |, so the| .(. and|
|00004410| 20 61 6e 79 20 69 6e 74 | 65 72 76 65 6e 69 6e 67 | any int|ervening|
|00004420| 20 77 68 69 74 65 20 73 | 70 61 63 65 0d 09 09 09 | white s|pace....|
|00004430| 09 09 09 6d 75 73 74 20 | 62 65 20 70 75 74 20 62 |...must |be put b|
|00004440| 61 63 6b 20 69 6e 74 6f | 20 74 68 65 20 72 65 70 |ack into| the rep|
|00004450| 6c 61 63 65 6d 65 6e 74 | 20 73 74 72 69 6e 67 20 |lacement| string |
|00004460| 62 79 0d 09 09 09 09 09 | 09 74 61 67 67 69 6e 67 |by......|.tagging|
|00004470| 20 74 68 65 6d 20 69 6e | 20 70 61 72 65 6e 74 68 | them in| parenth|
|00004480| 65 73 65 73 20 61 6e 64 | 20 75 73 69 6e 67 20 5c |eses and| using \|
|00004490| 31 20 61 66 74 65 72 0d | 09 09 09 09 09 09 d2 46 |1 after.|.......F|
|000044a0| 75 6e 63 4e 61 6d 65 d3 | 20 74 6f 20 72 65 66 65 |uncName.| to refe|
|000044b0| 72 20 74 6f 20 77 68 61 | 74 20 77 61 73 20 6d 61 |r to wha|t was ma|
|000044c0| 74 63 68 65 64 20 62 79 | 20 74 68 65 0d 09 09 09 |tched by| the....|
|000044d0| 09 09 09 66 69 72 73 74 | 20 73 65 74 20 6f 66 20 |...first| set of |
|000044e0| 70 61 72 65 6e 74 68 65 | 73 65 73 20 69 6e 20 74 |parenthe|ses in t|
|000044f0| 68 65 20 70 61 74 74 65 | 72 6e 2e 0d 0d 0d 57 69 |he patte|rn....Wi|
|00004500| 74 68 69 6e 20 61 20 63 | 68 61 72 61 63 74 65 72 |thin a c|haracter|
|00004510| 20 63 6c 61 73 73 20 6d | 6f 73 74 20 6d 65 74 61 | class m|ost meta|
|00004520| 63 68 61 72 61 63 74 65 | 72 73 20 61 72 65 20 74 |characte|rs are t|
|00004530| 61 6b 65 6e 20 6c 69 74 | 65 72 61 6c 6c 79 2e 20 |aken lit|erally. |
|00004540| 54 68 65 0d 65 78 63 65 | 70 74 69 6f 6e 73 20 61 |The.exce|ptions a|
|00004550| 72 65 20 74 68 65 20 65 | 73 63 61 70 69 6e 67 20 |re the e|scaping |
|00004560| 62 61 63 6b 73 6c 61 73 | 68 20 5c 2c 20 74 68 65 |backslas|h \, the|
|00004570| 20 6e 65 67 61 74 69 6e | 67 20 5e 20 28 6f 6e 6c | negatin|g ^ (onl|
|00004580| 79 20 61 74 20 74 68 65 | 0d 62 65 67 69 6e 6e 69 |y at the|.beginni|
|00004590| 6e 67 29 2c 20 61 6e 64 | 20 74 68 65 20 72 61 6e |ng), and| the ran|
|000045a0| 67 65 20 68 79 70 68 65 | 6e 20 2d 20 28 6f 6e 6c |ge hyphe|n - (onl|
|000045b0| 79 20 62 65 74 77 65 65 | 6e 20 74 77 6f 20 63 68 |y betwee|n two ch|
|000045c0| 61 72 61 63 74 65 72 73 | 29 2e 20 46 6f 72 0d 65 |aracters|). For.e|
|000045d0| 78 61 6d 70 6c 65 2c 0d | 09 09 5b 41 2d 5a 61 2d |xample,.|..[A-Za-|
|000045e0| 7a 2d 5d 09 09 6d 61 74 | 63 68 65 73 20 61 6e 20 |z-]..mat|ches an |
|000045f0| 45 6e 67 6c 69 73 68 20 | 77 6f 72 64 2c 20 68 79 |English |word, hy|
|00004600| 70 68 65 6e 73 20 69 6e | 63 6c 75 64 65 64 0d 09 |phens in|cluded..|
|00004610| 09 5b 2d 41 2d 5a 61 2d | 7a 5d 09 09 64 6f 65 73 |.[-A-Za-|z]..does|
|00004620| 20 74 68 65 20 73 61 6d | 65 0d 09 09 5b 5c 2d 41 | the sam|e...[\-A|
|00004630| 2d 5a 61 2d 7a 5d 09 09 | 61 6c 73 6f 20 64 6f 65 |-Za-z]..|also doe|
|00004640| 73 20 74 68 65 20 73 61 | 6d 65 20 28 74 68 65 20 |s the sa|me (the |
|00004650| 27 5c 27 20 69 73 20 75 | 6e 6e 65 63 65 73 73 61 |'\' is u|nnecessa|
|00004660| 72 79 20 62 75 74 20 68 | 61 72 6d 6c 65 73 73 29 |ry but h|armless)|
|00004670| 0d 09 09 5e 5b 5e 5e 5d | 09 09 09 6d 61 74 63 68 |...^[^^]|...match|
|00004680| 65 73 20 61 6e 79 20 73 | 69 6e 67 6c 65 20 63 68 |es any s|ingle ch|
|00004690| 61 72 61 63 74 65 72 20 | 74 68 61 74 20 69 73 20 |aracter |that is |
|000046a0| 6e 6f 74 20 61 20 27 5e | 27 20 61 74 0d 09 09 09 |not a '^|' at....|
|000046b0| 09 09 09 74 68 65 20 62 | 65 67 69 6e 6e 69 6e 67 |...the b|eginning|
|000046c0| 20 6f 66 20 61 20 73 74 | 72 69 6e 67 0d 09 09 5b | of a st|ring...[|
|000046d0| 5c 5e 5d 09 09 09 6d 61 | 74 63 68 65 73 20 61 20 |\^]...ma|tches a |
|000046e0| 27 5e 27 2e 0d 54 68 65 | 20 74 6f 75 67 68 65 73 |'^'..The| toughes|
|000046f0| 74 20 6d 65 74 61 63 68 | 61 72 61 63 74 65 72 20 |t metach|aracter |
|00004700| 74 6f 20 72 65 6d 65 6d | 62 65 72 20 69 73 20 74 |to remem|ber is t|
|00004710| 68 65 20 27 5e 27 20 77 | 68 69 63 68 20 68 61 73 |he '^' w|hich has|
|00004720| 20 74 68 72 65 65 0d 6d | 65 61 6e 69 6e 67 73 3a | three.m|eanings:|
|00004730| 20 61 74 20 74 68 65 20 | 62 65 67 69 6e 6e 69 6e | at the |beginnin|
|00004740| 67 20 6f 66 20 61 20 63 | 68 61 72 61 63 74 65 72 |g of a c|haracter|
|00004750| 20 63 6c 61 73 73 20 69 | 74 20 73 69 67 6e 61 6c | class i|t signal|
|00004760| 73 20 61 20 6e 65 67 61 | 74 65 64 0d 63 68 61 72 |s a nega|ted.char|
|00004770| 61 63 74 65 72 20 63 6c | 61 73 73 3b 20 6f 75 74 |acter cl|ass; out|
|00004780| 73 69 64 65 20 6f 66 20 | 61 20 63 68 61 72 61 63 |side of |a charac|
|00004790| 74 65 72 20 63 6c 61 73 | 73 20 69 74 20 6d 61 74 |ter clas|s it mat|
|000047a0| 63 68 65 73 20 74 68 65 | 20 62 65 67 69 6e 6e 69 |ches the| beginni|
|000047b0| 6e 67 20 6f 66 0d 61 20 | 73 74 72 69 6e 67 3b 20 |ng of.a |string; |
|000047c0| 61 6e 64 20 77 68 65 6e | 20 65 73 63 61 70 65 64 |and when| escaped|
|000047d0| 20 6f 72 20 6e 6f 74 20 | 74 68 65 20 66 69 72 73 | or not |the firs|
|000047e0| 74 20 63 68 61 72 61 63 | 74 65 72 20 69 6e 20 61 |t charac|ter in a|
|000047f0| 20 63 68 61 72 61 63 74 | 65 72 20 63 6c 61 73 73 | charact|er class|
|00004800| 0d 69 74 20 6d 61 74 63 | 68 65 73 20 61 20 6c 69 |.it matc|hes a li|
|00004810| 74 65 72 61 6c 20 27 5e | 27 2e 0d 0d 52 65 67 75 |teral '^|'...Regu|
|00004820| 6c 61 72 20 65 78 70 72 | 65 73 73 69 6f 6e 73 20 |lar expr|essions |
|00004830| 61 72 65 20 d2 6c 65 66 | 74 20 67 72 65 65 64 79 |are .lef|t greedy|
|00004840| d3 3b 20 77 68 65 72 65 | 20 74 68 65 72 65 20 63 |.; where| there c|
|00004850| 6f 75 6c 64 20 62 65 20 | 6d 6f 72 65 20 74 68 61 |ould be |more tha|
|00004860| 6e 20 6f 6e 65 0d 6d 61 | 74 63 68 20 69 6e 20 61 |n one.ma|tch in a|
|00004870| 20 73 74 72 69 6e 67 2c | 20 61 20 72 65 67 75 6c | string,| a regul|
|00004880| 61 72 20 65 78 70 72 65 | 73 73 69 6f 6e 20 6d 61 |ar expre|ssion ma|
|00004890| 74 63 68 65 73 20 74 68 | 65 20 6c 65 66 74 6d 6f |tches th|e leftmo|
|000048a0| 73 74 20 6f 6e 65 2c 20 | 61 6e 64 0d 65 78 74 65 |st one, |and.exte|
|000048b0| 6e 64 73 20 74 68 65 20 | 6d 61 74 63 68 20 61 73 |nds the |match as|
|000048c0| 20 66 61 72 20 61 73 20 | 70 6f 73 73 69 62 6c 65 | far as |possible|
|000048d0| 2e 0d 0d 4e 6f 77 20 74 | 68 61 74 20 77 65 d5 72 |...Now t|hat we.r|
|000048e0| 65 20 73 74 61 72 74 69 | 6e 67 20 74 6f 20 67 65 |e starti|ng to ge|
|000048f0| 74 20 74 68 65 20 68 61 | 6e 67 20 6f 66 20 74 68 |t the ha|ng of th|
|00004900| 69 6e 67 73 2c 20 6d 6f | 72 65 20 65 78 61 6d 70 |ings, mo|re examp|
|00004910| 6c 65 73 20 75 73 69 6e | 67 20 74 68 65 0d 72 65 |les usin|g the.re|
|00004920| 70 6c 61 63 65 6d 65 6e | 74 20 66 75 6e 63 74 69 |placemen|t functi|
|00004930| 6f 6e 73 20 d2 73 75 62 | d3 20 61 6e 64 20 d2 67 |ons .sub|. and .g|
|00004940| 73 75 62 d3 20 6d 65 6e | 74 69 6f 6e 65 64 20 61 |sub. men|tioned a|
|00004950| 62 6f 76 65 2e 20 54 68 | 65 20 66 6f 72 6d 61 74 |bove. Th|e format|
|00004960| 20 69 73 0d 73 75 62 28 | 72 2c 73 2c 74 29 20 77 | is.sub(|r,s,t) w|
|00004970| 68 65 72 65 20 72 20 69 | 73 20 61 20 72 65 67 75 |here r i|s a regu|
|00004980| 6c 61 72 20 65 78 70 72 | 65 73 73 69 6f 6e 2c 20 |lar expr|ession, |
|00004990| 73 20 69 73 20 74 68 65 | 20 72 65 70 6c 61 63 65 |s is the| replace|
|000049a0| 6d 65 6e 74 20 73 74 72 | 69 6e 67 2c 0d 61 6e 64 |ment str|ing,.and|
|000049b0| 20 74 20 69 73 20 74 68 | 65 20 73 74 72 69 6e 67 | t is th|e string|
|000049c0| 20 69 6e 20 77 68 69 63 | 68 20 74 68 65 20 73 65 | in whic|h the se|
|000049d0| 61 72 63 68 20 61 6e 64 | 20 72 65 70 6c 61 63 65 |arch and| replace|
|000049e0| 20 69 73 20 74 6f 20 62 | 65 20 64 6f 6e 65 2e 20 | is to b|e done. |
|000049f0| 54 68 65 0d 63 6f 6e 74 | 65 6e 74 73 20 6f 66 20 |The.cont|ents of |
|00004a00| 74 20 62 65 66 6f 72 65 | 20 61 6e 64 20 61 66 74 |t before| and aft|
|00004a10| 65 72 20 74 68 65 20 73 | 75 62 20 61 72 65 20 73 |er the s|ub are s|
|00004a20| 70 65 6c 6c 65 64 20 6f | 75 74 20 62 65 6c 6f 77 |pelled o|ut below|
|00004a30| 2e 0d 0d 75 73 69 6e 67 | 20 74 20 3d 20 22 44 6f |...using| t = "Do|
|00004a40| 6e d5 74 20 72 75 6e 20 | 74 68 61 74 20 70 72 75 |n.t run |that pru|
|00004a50| 6e 65 20 6f 76 65 72 2c | 20 72 75 6e 74 21 22 3a |ne over,| runt!":|
|00004a60| 0d 73 75 62 28 2f 72 75 | 6e 2f 2c 20 22 66 6c 79 |.sub(/ru|n/, "fly|
|00004a70| 22 2c 20 74 29 09 74 75 | 72 6e 73 20 74 20 69 6e |", t).tu|rns t in|
|00004a80| 74 6f 20 22 44 6f 6e d5 | 74 20 66 6c 79 20 74 68 |to "Don.|t fly th|
|00004a90| 61 74 20 70 72 75 6e 65 | 20 6f 76 65 72 2c 20 72 |at prune| over, r|
|00004aa0| 75 6e 74 21 22 0d 67 73 | 75 62 28 2f 72 75 6e 2f |unt!".gs|ub(/run/|
|00004ab0| 2c 20 22 66 6c 79 22 2c | 20 74 29 09 74 75 72 6e |, "fly",| t).turn|
|00004ac0| 73 20 74 20 69 6e 74 6f | 20 22 44 6f 6e d5 74 20 |s t into| "Don.t |
|00004ad0| 66 6c 79 20 74 68 61 74 | 20 70 66 6c 79 65 20 6f |fly that| pflye o|
|00004ae0| 76 65 72 2c 20 66 6c 79 | 74 21 22 0d 67 73 75 62 |ver, fly|t!".gsub|
|00004af0| 28 2f 5c 62 72 75 6e 5c | 62 2f 2c 20 22 66 6c 79 |(/\brun\|b/, "fly|
|00004b00| 22 2c 20 74 29 09 74 75 | 72 6e 73 20 74 20 69 6e |", t).tu|rns t in|
|00004b10| 74 6f 20 22 44 6f 6e d5 | 74 20 66 6c 79 20 74 68 |to "Don.|t fly th|
|00004b20| 61 74 20 70 72 75 6e 65 | 20 6f 76 65 72 2c 20 72 |at prune| over, r|
|00004b30| 75 6e 74 21 22 0d 67 73 | 75 62 28 2f 72 75 6e 2f |unt!".gs|ub(/run/|
|00004b40| 2c 20 22 74 26 6b 22 2c | 20 74 29 09 74 75 72 6e |, "t&k",| t).turn|
|00004b50| 73 20 74 20 69 6e 74 6f | 20 22 44 6f 6e d5 74 20 |s t into| "Don.t |
|00004b60| 74 72 75 6e 6b 20 74 68 | 61 74 20 70 74 72 75 6e |trunk th|at ptrun|
|00004b70| 6b 65 20 6f 76 65 72 2c | 20 74 72 75 6e 6b 74 21 |ke over,| trunkt!|
|00004b80| 22 0d 75 73 69 6e 67 20 | 74 20 3d 20 22 23 64 65 |".using |t = "#de|
|00004b90| 66 69 6e 65 20 46 4f 4f | 09 09 31 22 3a 0d 73 75 |fine FOO|..1":.su|
|00004ba0| 62 28 2f 23 64 65 66 69 | 6e 65 5c 57 2b 28 5c 77 |b(/#defi|ne\W+(\w|
|00004bb0| 2b 29 5c 57 2b 28 5b 30 | 2d 39 5d 2b 29 2f 2c 20 |+)\W+([0|-9]+)/, |
|00004bc0| 22 69 6e 74 20 5c 31 20 | 3d 20 5c 32 3b 22 2c 74 |"int \1 |= \2;",t|
|00004bd0| 29 20 74 75 72 6e 73 20 | 74 20 69 6e 74 6f 0d 09 |) turns |t into..|
|00004be0| 09 22 69 6e 74 20 46 4f | 4f 20 3d 20 31 3b 22 20 |."int FO|O = 1;" |
|00004bf0| 28 5c 57 2b 20 6d 65 61 | 6e 73 20 6f 6e 65 20 6f |(\W+ mea|ns one o|
|00004c00| 72 20 6d 6f 72 65 20 6e | 6f 6e 2d 77 6f 72 64 20 |r more n|on-word |
|00004c10| 63 68 61 72 61 63 74 65 | 72 73 2c 20 5c 77 2b 0d |characte|rs, \w+.|
|00004c20| 09 09 6d 65 61 6e 73 20 | 6f 6e 65 20 6f 72 20 6d |..means |one or m|
|00004c30| 6f 72 65 20 77 6f 72 64 | 20 63 68 61 72 61 63 74 |ore word| charact|
|00004c40| 65 72 73 2c 20 5b 30 2d | 39 5d 2b 20 6d 65 61 6e |ers, [0-|9]+ mean|
|00004c50| 73 20 6f 6e 65 20 6f 72 | 20 6d 6f 72 65 20 64 69 |s one or| more di|
|00004c60| 67 69 74 73 3b 0d 09 09 | 74 77 6f 20 67 72 6f 75 |gits;...|two grou|
|00004c70| 70 73 20 61 72 65 20 74 | 61 67 67 65 64 29 2e 0d |ps are t|agged)..|
|00004c80| 0d 54 68 72 65 65 20 70 | 72 6f 67 72 61 6d 73 20 |.Three p|rograms |
|00004c90| 61 72 65 20 73 75 70 70 | 6c 69 65 64 20 74 6f 20 |are supp|lied to |
|00004ca0| 68 65 6c 70 20 79 6f 75 | 20 64 6f 20 67 65 6e 65 |help you| do gene|
|00004cb0| 72 61 6c d0 70 75 72 70 | 6f 73 65 20 6c 69 73 74 |ral.purp|ose list|
|00004cc0| 69 6e 67 20 6f 66 0d 6d | 61 74 63 68 65 73 20 6f |ing of.m|atches o|
|00004cd0| 72 20 73 65 61 72 63 68 | d0 61 6e 64 d0 72 65 70 |r search|.and.rep|
|00004ce0| 6c 61 63 65 3b 20 24 4d | 46 53 4c 69 73 74 65 72 |lace; $M|FSLister|
|00004cf0| 20 73 65 61 72 63 68 65 | 73 20 66 6f 72 20 65 69 | searche|s for ei|
|00004d00| 74 68 65 72 20 70 6c 61 | 69 6e 20 74 65 78 74 0d |ther pla|in text.|
|00004d10| 6f 72 20 61 20 72 65 67 | 75 6c 61 72 20 65 78 70 |or a reg|ular exp|
|00004d20| 72 65 73 73 69 6f 6e 20 | 77 69 74 68 20 d2 53 65 |ression |with .Se|
|00004d30| 74 20 76 61 72 69 61 62 | 6c 65 73 d3 20 69 6e 20 |t variab|les. in |
|00004d40| 74 68 65 20 73 65 74 75 | 70 20 64 69 61 6c 6f 67 |the setu|p dialog|
|00004d50| 2c 20 61 6e 64 0d 6c 69 | 73 74 73 20 66 69 6c 65 |, and.li|sts file|
|00004d60| 20 6e 61 6d 65 2f 20 6c | 69 6e 65 20 6e 75 6d 62 | name/ l|ine numb|
|00004d70| 65 72 20 6f 66 20 61 6c | 6c 20 73 69 6e 67 6c 65 |er of al|l single|
|00004d80| d0 6c 69 6e 65 20 6d 61 | 74 63 68 65 73 20 74 6f |.line ma|tches to|
|00004d90| 20 73 74 64 6f 75 74 3b | 0d 24 4d 46 53 5f 53 75 | stdout;|.$MFS_Su|
|00004da0| 70 65 72 4c 69 73 74 65 | 72 20 64 6f 65 73 20 6d |perListe|r does m|
|00004db0| 75 63 68 20 74 68 65 20 | 73 61 6d 65 2c 20 62 75 |uch the |same, bu|
|00004dc0| 74 20 66 69 6e 64 73 20 | 6d 61 74 63 68 65 73 20 |t finds |matches |
|00004dd0| 74 68 61 74 20 73 70 61 | 6e 20 61 0d 76 61 72 69 |that spa|n a.vari|
|00004de0| 61 62 6c 65 20 6e 75 6d | 62 65 72 20 6f 66 20 6c |able num|ber of l|
|00004df0| 69 6e 65 73 3b 20 61 6e | 64 20 24 4d 46 53 5f 53 |ines; an|d $MFS_S|
|00004e00| 75 70 65 72 52 65 70 6c | 61 63 65 20 64 6f 65 73 |uperRepl|ace does|
|00004e10| 20 74 68 65 20 75 6c 74 | 69 6d 61 74 65 20 73 65 | the ult|imate se|
|00004e20| 61 72 63 68 0d 61 6e 64 | 20 72 65 70 6c 61 63 65 |arch.and| replace|
|00004e30| 2c 20 6d 61 74 63 68 69 | 6e 67 20 65 69 74 68 65 |, matchi|ng eithe|
|00004e40| 72 20 70 6c 61 69 6e 20 | 74 65 78 74 20 6f 72 20 |r plain |text or |
|00004e50| 66 75 6c 6c d0 62 6c 6f | 77 6e 20 72 65 67 75 6c |full.blo|wn regul|
|00004e60| 61 72 20 65 78 70 72 65 | 73 73 69 6f 6e 73 0d 6f |ar expre|ssions.o|
|00004e70| 76 65 72 20 61 20 76 61 | 72 69 61 62 6c 65 20 6e |ver a va|riable n|
|00004e80| 75 6d 62 65 72 20 6f 66 | 20 6c 69 6e 65 73 2c 20 |umber of| lines, |
|00004e90| 68 61 6e 64 6c 69 6e 67 | 20 61 6e 79 20 6e 75 6d |handling| any num|
|00004ea0| 62 65 72 20 6f 66 20 66 | 69 6c 65 73 20 61 74 20 |ber of f|iles at |
|00004eb0| 6f 6e 63 65 2c 0d 64 6f | 63 75 6d 65 6e 74 69 6e |once,.do|cumentin|
|00004ec0| 67 20 74 68 65 20 28 70 | 6f 73 74 d0 63 68 61 6e |g the (p|ost.chan|
|00004ed0| 67 65 29 20 6c 6f 63 61 | 74 69 6f 6e 73 20 6f 66 |ge) loca|tions of|
|00004ee0| 20 61 6c 6c 20 63 68 61 | 6e 67 65 73 20 74 6f 20 | all cha|nges to |
|00004ef0| 73 74 64 6f 75 74 2e 20 | 48 65 63 6b 2c 20 69 74 |stdout. |Heck, it|
|00004f00| 0d 65 76 65 6e 20 70 72 | 69 6e 74 73 20 74 68 65 |.even pr|ints the|
|00004f10| 20 66 72 61 67 6d 65 6e | 74 73 20 6f 66 20 6f 72 | fragmen|ts of or|
|00004f20| 69 67 69 6e 61 6c 20 74 | 65 78 74 20 62 65 66 6f |iginal t|ext befo|
|00004f30| 72 65 20 74 68 65 20 63 | 68 61 6e 67 65 73 2c 20 |re the c|hanges, |
|00004f40| 73 6f 20 74 68 61 74 20 | 69 66 0d 79 6f 75 20 6d |so that |if.you m|
|00004f50| 65 73 73 20 75 70 20 79 | 6f 75 20 63 61 6e 20 61 |ess up y|ou can a|
|00004f60| 74 20 6c 65 61 73 74 20 | 28 6d 61 6e 75 61 6c 6c |t least |(manuall|
|00004f70| 79 29 20 75 6e 64 6f 20 | 74 68 65 20 64 61 6d 61 |y) undo |the dama|
|00004f80| 67 65 2e 0d 09 2a 2f 7d | 3b 0d 0d 73 74 72 75 63 |ge...*/}|;..struc|
|00004f90| 74 20 70 61 74 74 65 72 | 6e 73 0d 09 7b 2f 2a 0d |t patter|ns..{/*.|
|00004fa0| 09 53 75 6d 6d 61 72 79 | 20 6f 66 20 70 61 74 74 |.Summary| of patt|
|00004fb0| 65 72 6e 73 0d 41 20 6c | 69 73 74 20 6f 66 20 62 |erns.A l|ist of b|
|00004fc0| 65 61 73 74 73 20 69 6e | 20 74 68 65 20 70 61 74 |easts in| the pat|
|00004fd0| 74 65 72 6e 20 7a 6f 6f | 20 28 72 65 67 65 78 20 |tern zoo| (regex |
|00004fe0| 73 74 61 6e 64 73 20 66 | 6f 72 20 72 65 67 75 6c |stands f|or regul|
|00004ff0| 61 72 20 65 78 70 72 65 | 73 73 69 6f 6e 2c 0d 70 |ar expre|ssion,.p|
|00005000| 61 74 20 73 74 61 6e 64 | 73 20 66 6f 72 20 70 61 |at stand|s for pa|
|00005010| 74 74 65 72 6e 2c 20 73 | 74 72 20 73 74 61 6e 64 |ttern, s|tr stand|
|00005020| 73 20 66 6f 72 20 73 74 | 72 69 6e 67 20 76 61 72 |s for st|ring var|
|00005030| 69 61 62 6c 65 29 3a 0d | 50 61 74 74 65 72 6e 09 |iable):.|Pattern.|
|00005040| 09 09 09 09 09 09 09 09 | 09 45 78 61 6d 70 6c 65 |........|.Example|
|00005050| 0d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |.-------|--------|
|00005060| 2d 09 09 09 09 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |-....---|--------|
|00005070| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005080| 2d 2d 2d 2d 0d 42 45 47 | 49 4e 09 09 09 09 09 09 |----.BEG|IN......|
|00005090| 09 42 45 47 49 4e 20 62 | 6c 6f 63 6b 73 20 61 72 |.BEGIN b|locks ar|
|000050a0| 65 20 64 6f 6e 65 20 62 | 65 66 6f 72 65 20 61 6c |e done b|efore al|
|000050b0| 6c 20 69 6e 70 75 74 0d | 45 4e 44 09 09 09 09 09 |l input.|END.....|
|000050c0| 09 09 09 45 4e 44 20 62 | 6c 6f 63 6b 73 20 61 72 |...END b|locks ar|
|000050d0| 65 20 64 6f 6e 65 20 61 | 66 74 65 72 20 61 6c 6c |e done a|fter all|
|000050e0| 20 69 6e 70 75 74 0d 2f | 72 65 67 65 78 2f 09 09 | input./|regex/..|
|000050f0| 09 09 09 09 09 2f 4d 61 | 72 79 28 20 5c 74 29 2b |...../Ma|ry( \t)+|
|00005100| 68 61 64 2f 0d 73 74 72 | 20 7e 20 2f 72 65 67 65 |had/.str| ~ /rege|
|00005110| 78 2f 09 09 09 09 09 28 | 6f 72 20 21 7e 29 09 24 |x/.....(|or !~).$|
|00005120| 31 20 7e 20 2f 28 5c 2d | 29 3f 5b 30 2d 39 5d 2b |1 ~ /(\-|)?[0-9]+|
|00005130| 2f 0d 73 74 72 20 7e 20 | 22 72 65 67 65 78 22 09 |/.str ~ |"regex".|
|00005140| 09 09 09 09 28 6f 72 20 | 21 7e 29 09 24 31 20 7e |....(or |!~).$1 ~|
|00005150| 20 22 28 5c 5c 2d 29 3f | 5b 30 2d 39 5d 2b 22 0d | "(\\-)?|[0-9]+".|
|00005160| 72 65 6c 61 74 69 6f 6e | 61 6c 20 65 78 70 72 65 |relation|al expre|
|00005170| 73 73 69 6f 6e 09 09 09 | 4e 46 20 3e 20 34 0d 70 |ssion...|NF > 4.p|
|00005180| 61 74 74 65 72 6e 20 26 | 26 20 70 61 74 74 65 72 |attern &|& patter|
|00005190| 6e 09 09 09 09 46 4e 52 | 20 3d 3d 20 31 20 26 26 |n....FNR| == 1 &&|
|000051a0| 20 2f 46 69 6c 65 20 74 | 69 74 6c 65 3a 2f 0d 70 | /File t|itle:/.p|
|000051b0| 61 74 74 65 72 6e 20 7c | 7c 20 70 61 74 74 65 72 |attern ||| patter|
|000051c0| 6e 09 09 09 09 2f 56 65 | 72 6d 6f 6e 74 2f 20 7c |n..../Ve|rmont/ ||
|000051d0| 7c 20 2f 4d 61 69 6e 65 | 2f 0d 70 61 74 74 65 72 || /Maine|/.patter|
|000051e0| 6e 20 3f 20 70 61 74 74 | 65 72 6e 20 3a 20 70 61 |n ? patt|ern : pa|
|000051f0| 74 74 65 72 6e 09 09 24 | 33 20 21 3d 20 30 20 3f |ttern..$|3 != 0 ?|
|00005200| 20 24 32 20 2f 20 24 33 | 20 3e 20 32 35 20 3a 20 | $2 / $3| > 25 : |
|00005210| 24 32 20 3c 20 30 0d 28 | 20 70 61 74 74 65 72 6e |$2 < 0.(| pattern|
|00005220| 20 29 09 09 09 09 09 09 | 2d 20 73 65 65 20 6e 65 | )......|- see ne|
|00005230| 78 74 20 6c 69 6e 65 0d | 21 20 70 61 74 74 65 72 |xt line.|! patter|
|00005240| 6e 09 09 09 09 09 09 21 | 28 24 30 20 3d 3d 20 22 |n......!|($0 == "|
|00005250| 22 20 7c 7c 20 24 30 20 | 7e 2f 5e 54 68 65 20 65 |" || $0 |~/^The e|
|00005260| 6e 64 24 2f 29 20 0d 70 | 61 74 74 65 72 6e 31 20 |nd$/) .p|attern1 |
|00005270| 2c 20 70 61 74 74 65 72 | 6e 32 09 09 09 09 46 4e |, patter|n2....FN|
|00005280| 52 20 3d 3d 20 35 2c 20 | 46 4e 52 20 3d 3d 20 38 |R == 5, |FNR == 8|
|00005290| 0d 09 2a 2f 7d 3b 0d 0d | 73 74 72 75 63 74 20 6f |..*/};..|struct o|
|000052a0| 70 65 72 61 74 6f 72 73 | 0d 09 7b 2f 2a 0d 54 68 |perators|..{/*.Th|
|000052b0| 65 20 6f 70 65 72 61 74 | 6f 72 73 20 69 6e 20 68 |e operat|ors in h|
|000052c0| 41 57 4b 2c 20 69 6e 20 | 6f 72 64 65 72 20 6f 66 |AWK, in |order of|
|000052d0| 20 69 6e 63 72 65 61 73 | 69 6e 67 20 70 72 65 63 | increas|ing prec|
|000052e0| 65 64 65 6e 63 65 2c 20 | 61 72 65 3a 0d 2d 2d 2d |edence, |are:.---|
|000052f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005300| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005310| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00005320| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 0d 3d 20 09 09 2b |--------|--.= ..+|
|00005330| 3d 20 09 2d 3d 20 09 2a | 3d 20 09 2f 3d 20 09 25 |= .-= .*|= ./= .%|
|00005340| 3d 20 09 5e 3d 0d 41 73 | 73 69 67 6e 6d 65 6e 74 |= .^=.As|signment|
|00005350| 2e 20 42 6f 74 68 20 61 | 62 73 6f 6c 75 74 65 20 |. Both a|bsolute |
|00005360| 61 73 73 69 67 6e 6d 65 | 6e 74 20 28 20 76 61 72 |assignme|nt ( var|
|00005370| 20 22 20 3d 20 22 20 76 | 61 6c 75 65 20 29 20 61 | " = " v|alue ) a|
|00005380| 6e 64 0d 6f 70 65 72 61 | 74 6f 72 2d 61 73 73 69 |nd.opera|tor-assi|
|00005390| 67 6e 6d 65 6e 74 20 28 | 74 68 65 20 6f 74 68 65 |gnment (|the othe|
|000053a0| 72 20 66 6f 72 6d 73 29 | 20 61 72 65 20 73 75 70 |r forms)| are sup|
|000053b0| 70 6f 72 74 65 64 2e 20 | d2 61 20 2b 3d 20 62 d3 |ported. |.a += b.|
|000053c0| 20 69 73 0d 65 71 75 69 | 76 61 6c 65 6e 74 20 74 | is.equi|valent t|
|000053d0| 6f 20 d2 61 20 3d 20 61 | 20 2b 20 62 d3 2e 0d 0d |o .a = a| + b....|
|000053e0| 3f 3a 09 09 09 54 68 65 | 20 43 20 63 6f 6e 64 69 |?:...The| C condi|
|000053f0| 74 69 6f 6e 61 6c 20 65 | 78 70 72 65 73 73 69 6f |tional e|xpressio|
|00005400| 6e 2e 20 54 68 69 73 20 | 68 61 73 20 74 68 65 20 |n. This |has the |
|00005410| 66 6f 72 6d 0d 09 09 09 | 65 78 70 72 31 20 22 20 |form....|expr1 " |
|00005420| 3f 20 22 20 65 78 70 72 | 32 20 22 20 3a 20 22 20 |? " expr|2 " : " |
|00005430| 65 78 70 72 33 0d 49 66 | 20 65 78 70 72 31 20 69 |expr3.If| expr1 i|
|00005440| 73 20 74 72 75 65 2c 20 | 74 68 65 20 76 61 6c 75 |s true, |the valu|
|00005450| 65 20 6f 66 20 74 68 65 | 20 65 78 70 72 65 73 73 |e of the| express|
|00005460| 69 6f 6e 20 69 73 20 65 | 78 70 72 32 20 2c 20 6f |ion is e|xpr2 , o|
|00005470| 74 68 65 72 77 69 73 65 | 20 69 74 20 69 73 0d 65 |therwise| it is.e|
|00005480| 78 70 72 33 20 2e 20 4f | 6e 6c 79 20 6f 6e 65 20 |xpr3 . O|nly one |
|00005490| 6f 66 20 65 78 70 72 32 | 20 61 6e 64 20 65 78 70 |of expr2| and exp|
|000054a0| 72 33 20 69 73 20 65 76 | 61 6c 75 61 74 65 64 2e |r3 is ev|aluated.|
|000054b0| 0d 0d 7c 7c 09 09 09 6c | 6f 67 69 63 61 6c 20 4f |..||...l|ogical O|
|000054c0| 52 2e 20 49 6e 20 d2 61 | 20 7c 7c 20 62 d3 20 69 |R. In .a| || b. i|
|000054d0| 66 20 61 20 69 73 20 74 | 72 75 65 20 74 68 65 6e |f a is t|rue then|
|000054e0| 20 62 20 69 73 20 6e 6f | 74 20 65 76 61 6c 75 61 | b is no|t evalua|
|000054f0| 74 65 64 2e 0d 0d 26 26 | 09 09 09 6c 6f 67 69 63 |ted...&&|...logic|
|00005500| 61 6c 20 41 4e 44 2e 20 | 49 6e 20 d2 61 20 26 26 |al AND. |In .a &&|
|00005510| 20 62 d3 20 69 66 20 61 | 20 69 73 20 66 61 6c 73 | b. if a| is fals|
|00005520| 65 20 74 68 65 6e 20 62 | 20 69 73 20 6e 6f 74 20 |e then b| is not |
|00005530| 65 76 61 6c 75 61 74 65 | 64 2e 0d 0d 7e 20 21 7e |evaluate|d...~ !~|
|00005540| 09 09 72 65 67 75 6c 61 | 72 20 65 78 70 72 65 73 |..regula|r expres|
|00005550| 73 69 6f 6e 20 6d 61 74 | 63 68 2c 20 6e 65 67 61 |sion mat|ch, nega|
|00005560| 74 65 64 20 6d 61 74 63 | 68 2e 20 53 65 65 20 d2 |ted matc|h. See .|
|00005570| 53 74 72 69 6e 67 2d 6d | 61 74 63 68 69 6e 67 20 |String-m|atching |
|00005580| 70 61 74 74 65 72 6e 73 | d3 2e 0d 0d 3c 20 3c 3d |patterns|....< <=|
|00005590| 20 3e 20 3e 3d 20 21 3d | 20 3d 3d 0d 09 09 09 74 | > >= !=| ==....t|
|000055a0| 68 65 20 72 65 67 75 6c | 61 72 20 72 65 6c 61 74 |he regul|ar relat|
|000055b0| 69 6f 6e 61 6c 20 6f 70 | 65 72 61 74 6f 72 73 2e |ional op|erators.|
|000055c0| 20 4e 6f 74 65 20 65 73 | 70 65 63 69 61 6c 6c 79 | Note es|pecially|
|000055d0| 20 74 68 61 74 20 73 74 | 72 69 6e 67 73 0d 09 09 | that st|rings...|
|000055e0| 09 63 61 6e 20 62 65 20 | 63 6f 6d 70 61 72 65 64 |.can be |compared|
|000055f0| 2c 20 65 67 20 69 66 20 | 28 24 33 20 3d 3d 20 22 |, eg if |($3 == "|
|00005600| 63 61 74 22 29 2e 20 49 | 6e 20 d2 61 20 3c 3d 20 |cat"). I|n .a <= |
|00005610| 62 d3 20 6f 72 20 74 68 | 65 20 6c 69 6b 65 2c 0d |b. or th|e like,.|
|00005620| 09 09 09 69 66 20 62 6f | 74 68 20 61 72 67 75 6d |...if bo|th argum|
|00005630| 65 6e 74 73 20 61 72 65 | 20 6e 75 6d 62 65 72 73 |ents are| numbers|
|00005640| 20 74 68 65 20 63 6f 6d | 70 61 72 69 73 6f 6e 20 | the com|parison |
|00005650| 69 73 20 64 6f 6e 65 0d | 09 09 09 6e 75 6d 65 72 |is done.|...numer|
|00005660| 69 63 61 6c 6c 79 2c 20 | 6f 74 68 65 72 77 69 73 |ically, |otherwis|
|00005670| 65 20 74 68 65 79 20 61 | 72 65 20 63 6f 6d 70 61 |e they a|re compa|
|00005680| 72 65 64 20 61 73 20 41 | 53 43 49 49 20 73 74 72 |red as A|SCII str|
|00005690| 69 6e 67 73 2e 0d 0d 62 | 6c 61 6e 6b 09 09 73 74 |ings...b|lank..st|
|000056a0| 72 69 6e 67 20 63 6f 6e | 63 61 74 65 6e 61 74 69 |ring con|catenati|
|000056b0| 6f 6e 3b 20 20 69 66 20 | 61 20 3d 20 22 4a 6f 68 |on; if |a = "Joh|
|000056c0| 6e 22 20 61 6e 64 20 62 | 20 3d 20 22 48 65 6e 72 |n" and b| = "Henr|
|000056d0| 79 22 20 74 68 65 6e 0d | 09 09 09 63 20 3d 20 61 |y" then.|...c = a|
|000056e0| 20 62 3b 20 70 72 6f 64 | 75 63 65 73 20 63 20 3d | b; prod|uces c =|
|000056f0| 20 22 4a 6f 68 6e 48 65 | 6e 72 79 22 2e 0d 0d 2b | "JohnHe|nry"...+|
|00005700| 20 20 2d 09 09 61 64 64 | 69 74 69 6f 6e 20 61 6e | -..add|ition an|
|00005710| 64 20 73 75 62 74 72 61 | 63 74 69 6f 6e 2e 0d 0d |d subtra|ction...|
|00005720| 2a 20 2f 20 25 09 09 6d | 75 6c 74 69 70 6c 69 63 |* / %..m|ultiplic|
|00005730| 61 74 69 6f 6e 2c 20 64 | 69 76 69 73 69 6f 6e 2c |ation, d|ivision,|
|00005740| 20 61 6e 64 20 6d 6f 64 | 75 6c 75 73 20 28 78 25 | and mod|ulus (x%|
|00005750| 79 20 70 72 6f 64 75 63 | 65 73 20 74 68 65 0d 09 |y produc|es the..|
|00005760| 09 09 72 65 6d 61 69 6e | 64 65 72 20 6f 66 20 78 |..remain|der of x|
|00005770| 20 64 69 76 69 64 65 64 | 20 62 79 20 79 2c 20 65 | divided| by y, e|
|00005780| 71 75 69 76 61 6c 65 6e | 74 20 74 6f 20 78 20 2d |quivalen|t to x -|
|00005790| 20 69 6e 74 28 78 2f 79 | 29 2a 79 29 2e 0d 0d 2b | int(x/y|)*y)...+|
|000057a0| 20 20 2d 20 21 09 09 75 | 6e 61 72 79 20 70 6c 75 | - !..u|nary plu|
|000057b0| 73 2c 20 75 6e 61 72 79 | 20 6d 69 6e 75 73 2c 20 |s, unary| minus, |
|000057c0| 61 6e 64 20 6c 6f 67 69 | 63 61 6c 20 6e 65 67 61 |and logi|cal nega|
|000057d0| 74 69 6f 6e 2e 0d 0d 5e | 09 09 09 65 78 70 6f 6e |tion...^|...expon|
|000057e0| 65 6e 74 69 61 74 69 6f | 6e 2e 0d 0d 2b 2b 20 20 |entiatio|n...++ |
|000057f0| 2d 2d 09 69 6e 63 72 65 | 6d 65 6e 74 20 61 6e 64 |--.incre|ment and|
|00005800| 20 64 65 63 72 65 6d 65 | 6e 74 2c 20 62 6f 74 68 | decreme|nt, both|
|00005810| 20 70 72 65 66 69 78 20 | 61 6e 64 20 70 6f 73 74 | prefix |and post|
|00005820| 66 69 78 2e 0d 0d 24 09 | 09 09 66 69 65 6c 64 20 |fix...$.|..field |
|00005830| 72 65 66 65 72 65 6e 63 | 65 2e 20 24 30 20 69 73 |referenc|e. $0 is|
|00005840| 20 74 68 65 20 65 6e 74 | 69 72 65 20 63 75 72 72 | the ent|ire curr|
|00005850| 65 6e 74 20 72 65 63 6f | 72 64 2c 20 24 31 20 74 |ent reco|rd, $1 t|
|00005860| 68 65 20 66 69 72 73 74 | 0d 09 09 09 66 69 65 6c |he first|....fiel|
|00005870| 64 2c 20 61 6e 64 20 24 | 4e 46 20 74 68 65 20 6c |d, and $|NF the l|
|00005880| 61 73 74 20 66 69 65 6c | 64 2e 20 46 69 65 6c 64 |ast fiel|d. Field|
|00005890| 73 20 6d 61 79 20 62 65 | 20 63 68 61 6e 67 65 64 |s may be| changed|
|000058a0| 20 6f 72 20 61 64 64 65 | 64 2e 0d 09 2a 2f 7d 3b | or adde|d...*/};|
|000058b0| 0d 0d 73 74 72 75 63 74 | 20 6e 75 6d 65 72 69 63 |..struct| numeric|
|000058c0| 20 2f 2a 66 75 6e 63 74 | 69 6f 6e 73 20 2a 2f 0d | /*funct|ions */.|
|000058d0| 09 7b 2f 2a 0d 09 42 75 | 69 6c 74 d0 69 6e 20 6e |.{/*..Bu|ilt.in n|
|000058e0| 75 6d 65 72 69 63 20 66 | 75 6e 63 74 69 6f 6e 73 |umeric f|unctions|
|000058f0| 0d 68 41 57 4b 20 68 61 | 73 20 74 68 65 20 66 6f |.hAWK ha|s the fo|
|00005900| 6c 6c 6f 77 69 6e 67 20 | 70 72 65 2d 64 65 66 69 |llowing |pre-defi|
|00005910| 6e 65 64 20 61 72 69 74 | 68 6d 65 74 69 63 20 66 |ned arit|hmetic f|
|00005920| 75 6e 63 74 69 6f 6e 73 | 2c 20 77 69 74 68 20 78 |unctions|, with x|
|00005930| 20 61 6e 64 20 79 20 61 | 73 0d 61 72 62 69 74 72 | and y a|s.arbitr|
|00005940| 61 72 79 20 65 78 70 72 | 65 73 73 69 6f 6e 73 3a |ary expr|essions:|
|00005950| 0d 61 74 61 6e 32 28 20 | 79 20 2c 20 78 20 29 09 |.atan2( |y , x ).|
|00005960| 09 72 65 74 75 72 6e 73 | 20 74 68 65 20 61 72 63 |.returns| the arc|
|00005970| 74 61 6e 67 65 6e 74 20 | 6f 66 20 79 2f 78 20 69 |tangent |of y/x i|
|00005980| 6e 20 72 61 64 69 61 6e | 73 2e 0d 63 6f 73 28 20 |n radian|s..cos( |
|00005990| 78 20 29 09 09 09 72 65 | 74 75 72 6e 73 20 74 68 |x )...re|turns th|
|000059a0| 65 20 63 6f 73 69 6e 65 | 20 6f 66 20 78 20 69 6e |e cosine| of x in|
|000059b0| 20 72 61 64 69 61 6e 73 | 2e 0d 65 78 70 28 20 78 | radians|..exp( x|
|000059c0| 20 29 09 09 09 74 68 65 | 20 65 78 70 6f 6e 65 6e | )...the| exponen|
|000059d0| 74 69 61 6c 20 66 75 6e | 63 74 69 6f 6e 20 22 65 |tial fun|ction "e|
|000059e0| 20 74 6f 20 74 68 65 20 | 78 22 0d 69 6e 74 28 20 | to the |x".int( |
|000059f0| 78 20 29 09 09 09 74 72 | 75 6e 63 61 74 65 73 20 |x )...tr|uncates |
|00005a00| 74 6f 20 69 6e 74 65 67 | 65 72 20 28 65 67 20 69 |to integ|er (eg i|
|00005a10| 6e 74 28 37 2e 33 32 35 | 29 20 67 69 76 65 73 20 |nt(7.325|) gives |
|00005a20| 37 29 3b 20 74 6f 20 72 | 6f 75 6e 64 2c 0d 09 09 |7); to r|ound,...|
|00005a30| 09 09 09 75 73 65 20 69 | 6e 74 28 78 20 2b 20 2e |...use i|nt(x + .|
|00005a40| 35 29 2e 0d 6c 6f 67 28 | 20 78 20 29 09 09 09 74 |5)..log(| x )...t|
|00005a50| 68 65 20 6e 61 74 75 72 | 61 6c 20 6c 6f 67 61 72 |he natur|al logar|
|00005a60| 69 74 68 6d 20 66 75 6e | 63 74 69 6f 6e 2c 20 62 |ithm fun|ction, b|
|00005a70| 61 73 65 20 65 2e 20 46 | 6f 72 20 6c 6f 67 20 62 |ase e. F|or log b|
|00005a80| 61 73 65 20 31 30 2c 20 | 75 73 65 0d 09 09 09 09 |ase 10, |use.....|
|00005a90| 09 6c 6f 67 28 78 29 2f | 6c 6f 67 28 31 30 29 2e |.log(x)/|log(10).|
|00005aa0| 0d 72 61 6e 64 28 29 09 | 09 09 09 72 65 74 75 72 |.rand().|...retur|
|00005ab0| 6e 73 20 61 20 72 61 6e | 64 6f 6d 20 6e 75 6d 62 |ns a ran|dom numb|
|00005ac0| 65 72 2c 20 30 20 3c 3d | 20 72 61 6e 64 28 29 20 |er, 0 <=| rand() |
|00005ad0| 3c 20 31 2e 0d 73 69 6e | 28 20 78 20 29 09 09 09 |< 1..sin|( x )...|
|00005ae0| 72 65 74 75 72 6e 73 20 | 74 68 65 20 73 69 6e 65 |returns |the sine|
|00005af0| 20 6f 66 20 78 20 69 6e | 20 72 61 64 69 61 6e 73 | of x in| radians|
|00005b00| 2e 0d 73 71 72 74 28 20 | 78 20 29 09 09 09 74 68 |..sqrt( |x )...th|
|00005b10| 65 20 73 71 75 61 72 65 | 20 72 6f 6f 74 20 66 75 |e square| root fu|
|00005b20| 6e 63 74 69 6f 6e 2e 0d | 73 72 61 6e 64 28 20 78 |nction..|srand( x|
|00005b30| 20 29 09 09 09 75 73 65 | 20 78 20 61 73 20 61 20 | )...use| x as a |
|00005b40| 6e 65 77 20 73 65 65 64 | 20 66 6f 72 20 74 68 65 |new seed| for the|
|00005b50| 20 72 61 6e 64 6f 6d 20 | 6e 75 6d 62 65 72 20 67 | random |number g|
|00005b60| 65 6e 65 72 61 74 6f 72 | 2e 0d 09 09 09 09 09 49 |enerator|.......I|
|00005b70| 66 20 6e 6f 20 78 20 69 | 73 20 70 72 6f 76 69 64 |f no x i|s provid|
|00005b80| 65 64 2c 20 74 68 65 20 | 74 69 6d 65 20 6f 66 20 |ed, the |time of |
|00005b90| 64 61 79 20 77 69 6c 6c | 20 62 65 20 75 73 65 64 |day will| be used|
|00005ba0| 2e 20 54 68 65 0d 09 09 | 09 09 09 72 65 74 75 72 |. The...|...retur|
|00005bb0| 6e 20 76 61 6c 75 65 20 | 69 73 20 74 68 65 20 70 |n value |is the p|
|00005bc0| 72 65 76 69 6f 75 73 20 | 73 65 65 64 20 66 6f 72 |revious |seed for|
|00005bd0| 20 74 68 65 20 72 61 6e | 64 6f 6d 0d 09 09 09 09 | the ran|dom.....|
|00005be0| 09 6e 75 6d 62 65 72 20 | 67 65 6e 65 72 61 74 6f |.number |generato|
|00005bf0| 72 2e 0d 09 2a 2f 7d 3b | 0d 0d 73 74 72 75 63 74 |r...*/};|..struct|
|00005c00| 20 73 74 72 69 6e 67 20 | 2f 2a 66 75 6e 63 74 69 | string |/*functi|
|00005c10| 6f 6e 73 2a 2f 0d 09 7b | 2f 2a 0d 09 42 75 69 6c |ons*/..{|/*..Buil|
|00005c20| 74 d0 69 6e 20 73 74 72 | 69 6e 67 20 66 75 6e 63 |t.in str|ing func|
|00005c30| 74 69 6f 6e 73 0d 54 68 | 65 72 65 20 69 73 20 6f |tions.Th|ere is o|
|00005c40| 6e 6c 79 20 6f 6e 65 20 | 73 74 72 69 6e 67 20 6f |nly one |string o|
|00005c50| 70 65 72 61 74 6f 72 2c | 20 74 68 65 20 63 6f 6e |perator,| the con|
|00005c60| 63 61 74 65 6e 61 74 69 | 6f 6e 20 6f 70 65 72 61 |catenati|on opera|
|00005c70| 74 6f 72 2c 20 69 6e 76 | 6f 6b 65 64 0d 77 68 65 |tor, inv|oked.whe|
|00005c80| 6e 20 74 77 6f 20 76 61 | 72 69 61 62 6c 65 73 20 |n two va|riables |
|00005c90| 6f 72 20 63 6f 6e 73 74 | 61 6e 74 73 20 61 72 65 |or const|ants are|
|00005ca0| 20 73 65 70 61 72 61 74 | 65 64 20 62 79 20 61 20 | separat|ed by a |
|00005cb0| 73 70 61 63 65 2e 20 4f | 74 68 65 72 20 75 73 65 |space. O|ther use|
|00005cc0| 66 75 6c 0d 73 74 72 69 | 6e 67 20 6d 61 6e 75 69 |ful.stri|ng manui|
|00005cd0| 70 75 6c 61 74 69 6f 6e | 73 20 69 6e 20 68 41 57 |pulation|s in hAW|
|00005ce0| 4b 20 61 72 65 20 63 61 | 72 72 69 65 64 20 6f 75 |K are ca|rried ou|
|00005cf0| 74 20 62 79 20 62 75 69 | 6c 74 d0 69 6e 20 66 75 |t by bui|lt.in fu|
|00005d00| 6e 63 74 69 6f 6e 73 2e | 20 49 6e 0d 74 68 65 20 |nctions.| In.the |
|00005d10| 66 6f 6c 6c 6f 77 69 6e | 67 20 74 61 62 6c 65 2c |followin|g table,|
|00005d20| 20 72 20 69 73 20 61 20 | 72 65 67 75 6c 61 72 20 | r is a |regular |
|00005d30| 65 78 70 72 65 73 73 69 | 6f 6e 2c 20 73 20 61 6e |expressi|on, s an|
|00005d40| 64 20 74 20 61 72 65 20 | 73 74 72 69 6e 67 73 2c |d t are |strings,|
|00005d50| 20 74 68 65 20 61 0d 61 | 6e 64 20 62 20 61 72 65 | the a.a|nd b are|
|00005d60| 20 61 72 72 61 79 73 2c | 20 61 6e 64 20 69 20 61 | arrays,| and i a|
|00005d70| 6e 64 20 6e 20 61 72 65 | 20 69 6e 74 65 67 65 72 |nd n are| integer|
|00005d80| 73 2e 0d 0d 67 73 75 62 | 28 72 2c 20 73 2c 20 74 |s...gsub|(r, s, t|
|00005d90| 29 09 09 66 6f 72 20 65 | 61 63 68 20 73 75 62 73 |)..for e|ach subs|
|00005da0| 74 72 69 6e 67 20 6d 61 | 74 63 68 69 6e 67 20 74 |tring ma|tching t|
|00005db0| 68 65 20 72 65 67 75 6c | 61 72 20 65 78 70 72 65 |he regul|ar expre|
|00005dc0| 73 73 69 6f 6e 20 72 0d | 09 09 09 09 09 69 6e 20 |ssion r.|.....in |
|00005dd0| 74 68 65 20 73 74 72 69 | 6e 67 20 74 20 2c 20 73 |the stri|ng t , s|
|00005de0| 75 62 73 74 69 74 75 74 | 65 73 20 74 68 65 20 73 |ubstitut|es the s|
|00005df0| 74 72 69 6e 67 20 73 20 | 2c 20 61 6e 64 0d 09 09 |tring s |, and...|
|00005e00| 09 09 09 72 65 74 75 72 | 6e 73 20 74 68 65 20 6e |...retur|ns the n|
|00005e10| 75 6d 62 65 72 20 6f 66 | 20 73 75 62 73 74 69 74 |umber of| substit|
|00005e20| 75 74 69 6f 6e 73 2e 20 | 49 66 20 74 20 69 73 20 |utions. |If t is |
|00005e30| 6e 6f 74 0d 09 09 09 09 | 09 73 75 70 70 6c 69 65 |not.....|.supplie|
|00005e40| 64 2c 20 75 73 65 73 20 | 24 30 20 2e 0d 69 6e 64 |d, uses |$0 ..ind|
|00005e50| 65 78 28 20 73 20 2c 20 | 20 74 20 29 09 09 72 65 |ex( s , | t )..re|
|00005e60| 74 75 72 6e 73 20 74 68 | 65 20 69 6e 64 65 78 20 |turns th|e index |
|00005e70| 6f 66 20 74 68 65 20 73 | 74 72 69 6e 67 20 74 20 |of the s|tring t |
|00005e80| 69 6e 20 74 68 65 20 73 | 74 72 69 6e 67 20 73 2c |in the s|tring s,|
|00005e90| 0d 09 09 09 09 09 6f 72 | 20 30 20 69 66 20 74 20 |......or| 0 if t |
|00005ea0| 69 73 20 6e 6f 74 20 70 | 72 65 73 65 6e 74 2e 0d |is not p|resent..|
|00005eb0| 6c 65 6e 67 74 68 28 20 | 73 20 29 09 09 09 72 65 |length( |s )...re|
|00005ec0| 74 75 72 6e 73 20 74 68 | 65 20 6c 65 6e 67 74 68 |turns th|e length|
|00005ed0| 20 6f 66 20 74 68 65 20 | 73 74 72 69 6e 67 20 73 | of the |string s|
|00005ee0| 20 2e 0d 6d 61 74 63 68 | 28 20 73 20 2c 20 72 20 | ..match|( s , r |
|00005ef0| 29 09 09 72 65 74 75 72 | 6e 73 20 74 68 65 20 70 |)..retur|ns the p|
|00005f00| 6f 73 69 74 69 6f 6e 20 | 69 6e 20 73 20 77 68 65 |osition |in s whe|
|00005f10| 72 65 20 74 68 65 20 72 | 65 67 75 6c 61 72 20 65 |re the r|egular e|
|00005f20| 78 70 72 65 73 73 69 6f | 6e 20 72 0d 09 09 09 09 |xpressio|n r.....|
|00005f30| 09 6f 63 63 75 72 73 2c | 20 6f 72 20 30 20 69 66 |.occurs,| or 0 if|
|00005f40| 20 72 20 69 73 20 6e 6f | 74 20 70 72 65 73 65 6e | r is no|t presen|
|00005f50| 74 2c 20 61 6e 64 20 73 | 65 74 73 20 74 68 65 20 |t, and s|ets the |
|00005f60| 76 61 6c 75 65 73 20 6f | 66 0d 09 09 09 09 09 52 |values o|f......R|
|00005f70| 53 54 41 52 54 20 61 6e | 64 20 52 4c 45 4e 47 54 |START an|d RLENGT|
|00005f80| 48 20 2e 0d 73 70 6c 69 | 74 28 73 2c 20 61 2c 20 |H ..spli|t(s, a, |
|00005f90| 72 29 09 09 73 70 6c 69 | 74 73 20 74 68 65 20 73 |r)..spli|ts the s|
|00005fa0| 74 72 69 6e 67 20 73 20 | 69 6e 74 6f 20 74 68 65 |tring s |into the|
|00005fb0| 20 61 72 72 61 79 20 61 | 20 6f 6e 20 74 68 65 20 | array a| on the |
|00005fc0| 72 65 67 75 6c 61 72 0d | 09 09 09 09 09 65 78 70 |regular.|.....exp|
|00005fd0| 72 65 73 73 69 6f 6e 20 | 72 20 2c 20 61 6e 64 20 |ression |r , and |
|00005fe0| 72 65 74 75 72 6e 73 20 | 74 68 65 20 6e 75 6d 62 |returns |the numb|
|00005ff0| 65 72 20 6f 66 20 66 69 | 65 6c 64 73 2e 20 49 66 |er of fi|elds. If|
|00006000| 20 72 20 69 73 0d 09 09 | 09 09 09 6f 6d 69 74 74 | r is...|...omitt|
|00006010| 65 64 2c 20 46 53 20 69 | 73 20 75 73 65 64 20 69 |ed, FS i|s used i|
|00006020| 6e 73 74 65 61 64 2e 0d | 73 70 72 69 6e 74 66 28 |nstead..|sprintf(|
|00006030| 20 66 6d 74 20 2c 20 65 | 78 70 72 2d 6c 69 73 74 | fmt , e|xpr-list|
|00006040| 20 29 09 70 72 69 6e 74 | 73 20 65 78 70 72 2d 6c | ).print|s expr-l|
|00006050| 69 73 74 20 61 63 63 6f | 72 64 69 6e 67 20 74 6f |ist acco|rding to|
|00006060| 20 66 6d 74 20 2c 20 61 | 6e 64 20 72 65 74 75 72 | fmt , a|nd retur|
|00006070| 6e 73 20 74 68 65 0d 09 | 09 09 09 09 72 65 73 75 |ns the..|....resu|
|00006080| 6c 74 69 6e 67 20 73 74 | 72 69 6e 67 2e 20 53 65 |lting st|ring. Se|
|00006090| 65 20 74 68 65 20 64 69 | 73 63 75 73 73 69 6f 6e |e the di|scussion|
|000060a0| 20 6f 66 20 d2 70 72 69 | 6e 74 66 d3 20 66 6f 72 | of .pri|ntf. for|
|000060b0| 20 64 65 74 61 69 6c 73 | 2e 0d 73 75 62 28 72 2c | details|..sub(r,|
|000060c0| 20 73 2c 74 29 20 09 09 | 74 68 69 73 20 69 73 20 | s,t) ..|this is |
|000060d0| 6a 75 73 74 20 6c 69 6b | 65 20 67 73 75 62 20 2c |just lik|e gsub ,|
|000060e0| 20 62 75 74 20 6f 6e 6c | 79 20 74 68 65 20 6c 65 | but onl|y the le|
|000060f0| 66 74 6d 6f 73 74 20 6d | 61 74 63 68 69 6e 67 0d |ftmost m|atching.|
|00006100| 09 09 09 09 09 73 75 62 | 73 74 72 69 6e 67 20 69 |.....sub|string i|
|00006110| 73 20 72 65 70 6c 61 63 | 65 64 2e 20 52 65 74 75 |s replac|ed. Retu|
|00006120| 72 6e 73 20 6e 75 6d 62 | 65 72 20 6f 66 20 73 75 |rns numb|er of su|
|00006130| 62 73 74 69 74 75 74 69 | 6f 6e 73 2e 0d 73 75 62 |bstituti|ons..sub|
|00006140| 73 74 72 28 73 2c 20 69 | 2c 20 6e 29 09 09 72 65 |str(s, i|, n)..re|
|00006150| 74 75 72 6e 73 20 74 68 | 65 20 6e 2d 63 68 61 72 |turns th|e n-char|
|00006160| 61 63 74 65 72 20 73 75 | 62 73 74 72 69 6e 67 20 |acter su|bstring |
|00006170| 6f 66 20 73 20 73 74 61 | 72 74 69 6e 67 20 61 74 |of s sta|rting at|
|00006180| 20 69 20 2e 20 49 66 20 | 6e 0d 09 09 09 09 09 69 | i . If |n......i|
|00006190| 73 20 6f 6d 69 74 74 65 | 64 2c 20 74 68 65 20 72 |s omitte|d, the r|
|000061a0| 65 73 74 20 6f 66 20 73 | 20 69 73 20 75 73 65 64 |est of s| is used|
|000061b0| 2e 0d 74 6f 6c 6f 77 65 | 72 28 20 73 20 29 09 09 |..tolowe|r( s )..|
|000061c0| 72 65 74 75 72 6e 73 20 | 61 20 63 6f 70 79 20 6f |returns |a copy o|
|000061d0| 66 20 74 68 65 20 73 74 | 72 69 6e 67 20 73 20 2c |f the st|ring s ,|
|000061e0| 20 77 69 74 68 20 61 6c | 6c 20 74 68 65 20 75 70 | with al|l the up|
|000061f0| 70 65 72 2d 63 61 73 65 | 0d 09 09 09 09 09 63 68 |per-case|......ch|
|00006200| 61 72 61 63 74 65 72 73 | 20 69 6e 20 73 20 74 72 |aracters| in s tr|
|00006210| 61 6e 73 6c 61 74 65 64 | 20 74 6f 20 74 68 65 69 |anslated| to thei|
|00006220| 72 20 63 6f 72 72 65 73 | 70 6f 6e 64 69 6e 67 0d |r corres|ponding.|
|00006230| 09 09 09 09 09 6c 6f 77 | 65 72 2d 63 61 73 65 20 |.....low|er-case |
|00006240| 63 6f 75 6e 74 65 72 70 | 61 72 74 73 2e 20 4e 6f |counterp|arts. No|
|00006250| 6e 2d 61 6c 70 68 61 62 | 65 74 69 63 20 63 68 61 |n-alphab|etic cha|
|00006260| 72 61 63 74 65 72 73 20 | 61 72 65 0d 09 09 09 09 |racters |are.....|
|00006270| 09 6c 65 66 74 20 75 6e | 63 68 61 6e 67 65 64 2e |.left un|changed.|
|00006280| 0d 74 6f 75 70 70 65 72 | 28 20 73 20 29 09 09 72 |.toupper|( s )..r|
|00006290| 65 74 75 72 6e 73 20 61 | 20 63 6f 70 79 20 6f 66 |eturns a| copy of|
|000062a0| 20 74 68 65 20 73 74 72 | 69 6e 67 20 73 20 2c 20 | the str|ing s , |
|000062b0| 77 69 74 68 20 61 6c 6c | 20 74 68 65 20 6c 6f 77 |with all| the low|
|000062c0| 65 72 2d 63 61 73 65 0d | 09 09 09 09 09 63 68 61 |er-case.|.....cha|
|000062d0| 72 61 63 74 65 72 73 20 | 69 6e 20 73 20 74 72 61 |racters |in s tra|
|000062e0| 6e 73 6c 61 74 65 64 20 | 74 6f 20 74 68 65 69 72 |nslated |to their|
|000062f0| 20 63 6f 72 72 65 73 70 | 6f 6e 64 69 6e 67 0d 09 | corresp|onding..|
|00006300| 09 09 09 09 75 70 70 65 | 72 2d 63 61 73 65 20 63 |....uppe|r-case c|
|00006310| 6f 75 6e 74 65 72 70 61 | 72 74 73 2e 20 4e 6f 6e |ounterpa|rts. Non|
|00006320| 2d 61 6c 70 68 61 62 65 | 74 69 63 20 63 68 61 72 |-alphabe|tic char|
|00006330| 61 63 74 65 72 73 20 61 | 72 65 0d 09 09 09 09 09 |acters a|re......|
|00006340| 6c 65 66 74 20 75 6e 63 | 68 61 6e 67 65 64 2e 0d |left unc|hanged..|
|00006350| 6c 6f 6f 6b 75 70 20 28 | 20 73 20 29 09 09 72 65 |lookup (| s )..re|
|00006360| 74 75 72 6e 73 20 69 6e | 74 65 67 65 72 d0 63 6f |turns in|teger.co|
|00006370| 64 65 64 20 43 20 74 79 | 70 65 20 6f 66 20 73 20 |ded C ty|pe of s |
|00006380| 28 73 20 73 68 6f 75 6c | 64 20 62 65 20 61 20 77 |(s shoul|d be a w|
|00006390| 6f 72 64 29 2e 0d 09 09 | 09 09 09 41 74 20 70 72 |ord)....|...At pr|
|000063a0| 65 73 65 6e 74 20 74 68 | 69 73 20 66 75 6e 63 74 |esent th|is funct|
|000063b0| 69 6f 6e 20 69 73 20 73 | 75 70 70 6f 72 74 65 64 |ion is s|upported|
|000063c0| 20 6f 6e 6c 79 20 62 79 | 20 45 6e 74 65 72 41 63 | only by| EnterAc|
|000063d0| 74 2e 0d 09 09 09 09 09 | 54 79 70 65 73 20 61 72 |t.......|Types ar|
|000063e0| 65 20 74 61 6b 65 6e 20 | 66 72 6f 6d 20 77 68 61 |e taken |from wha|
|000063f0| 74 65 76 65 72 20 45 6e | 74 65 72 41 63 74 20 70 |tever En|terAct p|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.